Class: WCC::Media::Client::Response

Inherits:
AbstractResponse
  • Object
show all
Defined in:
lib/wcc/media/client/response.rb

Instance Method Summary collapse

Instance Method Details

#collection_response?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/wcc/media/client/response.rb', line 15

def collection_response?
  body.key?('pagination')
end

#countObject



11
12
13
# File 'lib/wcc/media/client/response.rb', line 11

def count
  body.dig('pagination', 'total')
end

#next_page_queryObject



23
24
25
26
27
# File 'lib/wcc/media/client/response.rb', line 23

def next_page_query
  {
    offset: page_items.length + skip
  }
end

#page_itemsObject



19
20
21
# File 'lib/wcc/media/client/response.rb', line 19

def page_items
  body['messages'] || body['series'] || body['speakers'] || body['tags'] || body['streams']
end

#skipObject



7
8
9
# File 'lib/wcc/media/client/response.rb', line 7

def skip
  body.dig('pagination', 'offset')
end