class ResponseMate::Commands::Export
Command which performs the operations required by ‘response_mate list`
Public Class Methods
new(args, options)
click to toggle source
Calls superclass method
ResponseMate::Commands::Base::new
# File lib/response_mate/commands/export.rb, line 3 def initialize(args, options) super(args, options) @type = args.first || 'requests' @options[:environment] = ResponseMate::Environment.new(options[:environment]) @options[:manifest] = ResponseMate::Manifest.new(options[:requests_manifest]) end
Public Instance Methods
run()
click to toggle source
Run the command based on args, options provided
# File lib/response_mate/commands/export.rb, line 12 def run output = ResponseMate::Exporter.new(options).export if options[:upload] url = Faraday.post 'http://getpostman.com/collections' do |req| req.body = output.to_json end puts JSON.parse(url.body)['link'] else puts JSON.pretty_generate(output) end end