0.0
No commit activity in last 3 years
No release in over 3 years
Allows to parse Postman's JSON reqeuests collection dump and make requests from ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.0.0, ~> 2.0.0
 Project Readme

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