Sha256: f0bf201ee136ba6ed8e109c4dd9882bd0aded9b7f7cac8c5b595a25a2f855767

Contents?: true

Size: 588 Bytes

Versions: 7

Compression:

Stored size: 588 Bytes

Contents

module WCC
  module Media
    class Client < RestClient
      class Response < RestClient::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']
        end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wcc-media-client-0.2.4 lib/wcc/media/client/response.rb
wcc-media-client-0.2.3 lib/wcc/media/client/response.rb
wcc-media-client-0.2.2 lib/wcc/media/client/response.rb
wcc-media-client-0.2.1 lib/wcc/media/client/response.rb
wcc-media-client-0.2.0 lib/wcc/media/client/response.rb
wcc-media-client-0.1.1 lib/wcc/media/client/response.rb
wcc-media-client-0.1.0 lib/wcc/media/client/response.rb