class ResponseMate::Exporters::Postman::Environment
Handles exporting to postman format Example output www.getpostman.com/collections/dbc0521911e45471ff4a
Attributes
environment[RW]
out[RW]
Public Class Methods
new(environment)
click to toggle source
# File lib/response_mate/exporters/postman/environment.rb, line 8 def initialize(environment) @environment = environment @out = {} end
Public Instance Methods
export()
click to toggle source
Export the environment
# File lib/response_mate/exporters/postman/environment.rb, line 14 def export build_structure build_values out end
Private Instance Methods
build_structure()
click to toggle source
# File lib/response_mate/exporters/postman/environment.rb, line 22 def build_structure timestamp = Time.now.strftime('%Y%m%d%H%M%S') out.merge!( id: SecureRandom.uuid, name: "#{timestamp}_#{environment.env['environment_name'] || 'unnamed' }", values: [], timestamp: Time.now.to_i ) end
build_values()
click to toggle source
# File lib/response_mate/exporters/postman/environment.rb, line 33 def build_values environment.env.each_pair do |k, v| out_val = { key: k, value: v, type: 'text' } out[:values] << out_val end end