Class: ResponseMate::Exporters::Postman

Inherits:
Object
  • Object
show all
Defined in:
lib/response_mate/exporters/postman.rb,
lib/response_mate/exporters/postman/collection.rb,
lib/response_mate/exporters/postman/environment.rb

Overview

Handles exporting to postman format Example output www.getpostman.com/collections/dbc0521911e45471ff4a

Defined Under Namespace

Classes: Collection, Environment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manifest, environment, resource) ⇒ Response::Mate::Exporters::Postman

Parameters:


14
15
16
17
18
19
# File 'lib/response_mate/exporters/postman.rb', line 14

def initialize(manifest, environment, resource)
  @manifest    = manifest
  @environment = environment
  @resource    = resource
  @out = {}
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment


9
10
11
# File 'lib/response_mate/exporters/postman.rb', line 9

def environment
  @environment
end

#manifestObject

Returns the value of attribute manifest


9
10
11
# File 'lib/response_mate/exporters/postman.rb', line 9

def manifest
  @manifest
end

#outObject

Returns the value of attribute out


9
10
11
# File 'lib/response_mate/exporters/postman.rb', line 9

def out
  @out
end

#resourceObject

Returns the value of attribute resource


9
10
11
# File 'lib/response_mate/exporters/postman.rb', line 9

def resource
  @resource
end

Instance Method Details

#exportHash

Performs the export operation

Returns:

  • (Hash)

    The transformed resource


23
24
25
26
27
28
29
30
31
32
# File 'lib/response_mate/exporters/postman.rb', line 23

def export
  case resource
  when 'manifest'
    ResponseMate::Exporters::Postman::Collection.new(manifest).export
  when 'environment'
    ResponseMate::Exporters::Postman::Environment.new(environment).export
  else
    fail 'Unsupported resource'
  end
end