Sha256: 074e5761965976d8599bdc080d84ff546cfd3290da2b379d40283c7a01636beb

Contents?: true

Size: 638 Bytes

Versions: 9

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module WCC
  module Media
    class Client < ::WCC::API::RestClient
      class Response < AbstractResponse
        def skip
          body.dig('pagination', 'offset')
        end

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

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
wcc-media-client-0.7.5 lib/wcc/media/client/response.rb
wcc-media-client-0.7.4 lib/wcc/media/client/response.rb
wcc-media-client-0.7.3 lib/wcc/media/client/response.rb
wcc-media-client-0.7.2 lib/wcc/media/client/response.rb
wcc-media-client-0.7.1 lib/wcc/media/client/response.rb
wcc-media-client-0.7.0 lib/wcc/media/client/response.rb
wcc-media-client-0.6.1 lib/wcc/media/client/response.rb
wcc-media-client-0.6.0 lib/wcc/media/client/response.rb
wcc-media-client-0.5.0 lib/wcc/media/client/response.rb