Class: WCC::Media::Client::Response
Instance Attribute Summary
#client, #raw_body, #raw_response, #request
Instance Method Summary
collapse
#assert_ok!, #body, #each_page, #error_message, #first, #initialize, #items, #next_page, #next_page?
Instance Method Details
#collection_response? ⇒ Boolean
13
14
15
|
# File 'lib/wcc/media/client/response.rb', line 13
def collection_response?
body.key?('pagination')
end
|
#count ⇒ Object
9
10
11
|
# File 'lib/wcc/media/client/response.rb', line 9
def count
body.dig('pagination', 'total')
end
|
#next_page_query ⇒ Object
21
22
23
24
25
|
# File 'lib/wcc/media/client/response.rb', line 21
def next_page_query
{
offset: page_items.length + skip,
}
end
|
#page_items ⇒ Object
17
18
19
|
# File 'lib/wcc/media/client/response.rb', line 17
def page_items
body['messages'] || body['series'] || body['speakers'] || body['tags']
end
|
#skip ⇒ Object
5
6
7
|
# File 'lib/wcc/media/client/response.rb', line 5
def skip
body.dig('pagination', 'offset')
end
|