Class: PipeDream::Response
- Inherits:
-
Object
- Object
- PipeDream::Response
- Defined in:
- lib/pipe_dream/response.rb
Instance Method Summary collapse
- #etag ⇒ Object
-
#initialize(data) ⇒ Response
constructor
A new instance of Response.
- #items ⇒ Object
- #kind ⇒ Object
- #next_page_token ⇒ Object
- #region_code ⇒ Object
- #results_per_page ⇒ Object
- #total_results ⇒ Object
Constructor Details
#initialize(data) ⇒ Response
Returns a new instance of Response.
5 6 7 |
# File 'lib/pipe_dream/response.rb', line 5 def initialize(data) @data = JSON.parse(data) end |
Instance Method Details
#etag ⇒ Object
13 14 15 |
# File 'lib/pipe_dream/response.rb', line 13 def etag @etag ||= JSON.parse(data.fetch('etag')) end |
#items ⇒ Object
33 34 35 |
# File 'lib/pipe_dream/response.rb', line 33 def items @items ||= data.fetch('items').map { |item| Result.for(item) } end |
#kind ⇒ Object
9 10 11 |
# File 'lib/pipe_dream/response.rb', line 9 def kind @kind ||= data.fetch('kind') end |
#next_page_token ⇒ Object
17 18 19 |
# File 'lib/pipe_dream/response.rb', line 17 def next_page_token @next_page_token ||= data.fetch('nextPageToken') end |
#region_code ⇒ Object
21 22 23 |
# File 'lib/pipe_dream/response.rb', line 21 def region_code @region_code ||= data.fetch('regionCode') end |
#results_per_page ⇒ Object
29 30 31 |
# File 'lib/pipe_dream/response.rb', line 29 def results_per_page @results_per_page ||= page_info.fetch('resultsPerPage') end |
#total_results ⇒ Object
25 26 27 |
# File 'lib/pipe_dream/response.rb', line 25 def total_results @total_results ||= page_info.fetch('totalResults') end |