Skip to content

Parse & make http requests from Postman's (getpostman.com) exported collections (Collection V2)

Notifications You must be signed in to change notification settings

intrinio/postman-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Postman-Ruby

Play with Postman's request collections using Ruby.

Install

gem install postman-ruby

Usage

  1. Export collection from Postman to JSON file (Collection V2)
  2. Example code:
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

About

Parse & make http requests from Postman's (getpostman.com) exported collections (Collection V2)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%