Class: WCC::Media::Client::Response
- Inherits:
-
AbstractResponse
- Object
- AbstractResponse
- WCC::Media::Client::Response
- Defined in:
- lib/wcc/media/client/response.rb
Instance Method Summary collapse
- #collection_response? ⇒ Boolean
- #count ⇒ Object
- #next_page_query ⇒ Object
- #page_items ⇒ Object
- #skip ⇒ Object
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 |