Class: Sink::Resources::PaginationTests::Offset

Inherits:
Object
  • Object
show all
Defined in:
lib/sink/resources/pagination_tests/offset.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Offset

Returns a new instance of Offset.

Parameters:



8
9
10
# File 'lib/sink/resources/pagination_tests/offset.rb', line 8

def initialize(client:)
  @client = client
end

Instance Method Details

#list(params = {}, opts = {}) ⇒ Sink::PageOffset<Sink::Models::MyModel>

Test case for offset pagination

Parameters:

  • params (Hash{Symbol => Object}) (defaults to: {})

    Attributes to send in this request. @option params [Integer, nil] :limit @option params [Integer, nil] :offset

  • opts (Hash, Sink::RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:



21
22
23
24
25
26
27
28
29
30
# File 'lib/sink/resources/pagination_tests/offset.rb', line 21

def list(params = {}, opts = {})
  req = {
    method: :get,
    path: "/paginated/offset",
    query: params,
    page: Sink::PageOffset,
    model: Sink::Models::MyModel
  }
  @client.request(req, opts)
end

#list_no_start_field(params = {}, opts = {}) ⇒ Sink::PageOffsetNoStartField<Sink::Models::MyModel>

Test case for offset pagination with no start response field

Parameters:

  • params (Hash{Symbol => Object}) (defaults to: {})

    Attributes to send in this request. @option params [Integer, nil] :limit @option params [Integer, nil] :offset

  • opts (Hash, Sink::RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:



41
42
43
44
45
46
47
48
49
50
# File 'lib/sink/resources/pagination_tests/offset.rb', line 41

def list_no_start_field(params = {}, opts = {})
  req = {
    method: :get,
    path: "/paginated/offset/no_start_field",
    query: params,
    page: Sink::PageOffsetNoStartField,
    model: Sink::Models::MyModel
  }
  @client.request(req, opts)
end

#with_total_count(params = {}, opts = {}) ⇒ Sink::PageOffsetTotalCount<Sink::Models::MyModel>

Test case for offset pagination with a total count response property

Parameters:

  • params (Hash{Symbol => Object}) (defaults to: {})

    Attributes to send in this request. @option params [Integer, nil] :limit @option params [Integer, nil] :offset

  • opts (Hash, Sink::RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:



61
62
63
64
65
66
67
68
69
70
# File 'lib/sink/resources/pagination_tests/offset.rb', line 61

def with_total_count(params = {}, opts = {})
  req = {
    method: :get,
    path: "/paginated/offset/with_total_count",
    query: params,
    page: Sink::PageOffsetTotalCount,
    model: Sink::Models::MyModel
  }
  @client.request(req, opts)
end