Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josephbuchma/postman-ruby
Parse & make http requests from Postman's (getpostman.com) exported collections (Collection V2)
https://github.com/josephbuchma/postman-ruby
gem postman ruby
Last synced: 2 months ago
JSON representation
Parse & make http requests from Postman's (getpostman.com) exported collections (Collection V2)
- Host: GitHub
- URL: https://github.com/josephbuchma/postman-ruby
- Owner: josephbuchma
- Created: 2017-04-19T12:58:15.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-21T15:35:53.000Z (almost 8 years ago)
- Last Synced: 2024-10-14T06:52:20.575Z (3 months ago)
- Topics: gem, postman, ruby
- Language: Ruby
- Size: 4.88 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Postman-Ruby
Play with [Postman's](https://www.getpostman.com/) request collections using Ruby.
## Install
```
gem install postman-ruby
```## Usage
1. Export collection from Postman to JSON file (Collection V2)
2. Example code:```ruby
require 'postman-ruby'# Parse exported collection JSON
p = Postman.parse_file('exported_requests_collection.json')# Set some environment variables if needed
p.set_env('host' => 'http://localhost:9090', 'access_token' => 'x5CACj1cmrRLtt7EgIBxblYrfcrJVbQL820QJ1kNY')# Filter by hash
filtered = p.filter('method' => 'get', 'name'=>/.*(search|find).*/i)# Filter with block
filtered = p.filter do |r|
r.method == :get && r.name.include?('search') && r.url.raw.include?('foobar')
end# Make some requests
filtered.each do |r|
resp = r.execute # => RestClient::Response# ...
end```