Class: Uncomtrade::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/uncomtrade/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



8
9
10
11
12
# File 'lib/uncomtrade/response.rb', line 8

def initialize(response)
  @response = JSON.parse(response.body)
  check_status!
  @iterator = Helpers::Iterator.new(dataset)
end

Instance Method Details

#cherry_pick(options = {}) ⇒ Object



22
23
24
# File 'lib/uncomtrade/response.rb', line 22

def cherry_pick(options={})
  iterator.cherry_pick(selectors)
end

#datasetObject



18
19
20
# File 'lib/uncomtrade/response.rb', line 18

def dataset
  response["dataset"]
end

#resultObject



14
15
16
# File 'lib/uncomtrade/response.rb', line 14

def result
  response
end

#to_csv(file:, selectors: {}) ⇒ Object



26
27
28
# File 'lib/uncomtrade/response.rb', line 26

def to_csv(file:, selectors: {})
  iterator.to_csv(file, selectors)
end