Class: Dillo::Page

Inherits:
Collection show all
Defined in:
lib/dillo.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#connection

Instance Method Summary collapse

Methods inherited from Collection

#create_record, #each, #record_attributes, #records

Methods included from Finders

#[], #method_missing, #respond_to?

Methods inherited from Base

#body, #inspect, #json, root

Constructor Details

#initialize(collection, number) ⇒ Page

Returns a new instance of Page.



147
148
149
150
151
# File 'lib/dillo.rb', line 147

def initialize(collection, number)
  @collection = collection
  @number = number
  super()
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dillo::Finders

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



145
146
147
# File 'lib/dillo.rb', line 145

def collection
  @collection
end

#numberObject

Returns the value of attribute number.



145
146
147
# File 'lib/dillo.rb', line 145

def number
  @number
end

Instance Method Details

#pathObject



153
154
155
# File 'lib/dillo.rb', line 153

def path
  collection.path
end

#prepare_request(request) ⇒ Object



161
162
163
164
# File 'lib/dillo.rb', line 161

def prepare_request(request)
  request.params['limit'] = 200
  request.params['page'] = @number
end

#record_classObject



157
158
159
# File 'lib/dillo.rb', line 157

def record_class
  collection.record_class
end