Class: ResponseMate::Commands::Export
- Defined in:
- lib/response_mate/commands/export.rb
Overview
Command which performs the operations required by ‘response_mate list`
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(args, options) ⇒ Export
constructor
A new instance of Export.
-
#run ⇒ Object
Run the command based on args, options provided.
Constructor Details
#initialize(args, options) ⇒ Export
Returns a new instance of Export.
3 4 5 6 7 8 9 |
# File 'lib/response_mate/commands/export.rb', line 3 def initialize(args, ) super(args, ) @type = args.first || 'requests' @options[:environment] = ResponseMate::Environment.new([:environment]) @options[:manifest] = ResponseMate::Manifest.new([:requests_manifest]) end |
Instance Method Details
#run ⇒ Object
Run the command based on args, options provided
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/response_mate/commands/export.rb', line 12 def run output = ResponseMate::Exporter.new().export if [: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 |