Class: ApiResource::Conditions::PaginationCondition
- Inherits:
-
AbstractCondition
- Object
- AbstractCondition
- ApiResource::Conditions::PaginationCondition
- Defined in:
- lib/api_resource/conditions/pagination_condition.rb
Overview
Class to handle pagination params, passing of pagination params along to the server, and the retrieval of the headers from the response
Instance Attribute Summary
Attributes inherited from AbstractCondition
#association, #conditions, #included_objects, #internal_object, #klass, #remote_path
Instance Method Summary collapse
-
#initialize(klass, opts = {}) ⇒ PaginationCondition
constructor
Constructor - sets up the pagination options.
-
#paginated? ⇒ Boolean
Are we paginated?.
Methods inherited from AbstractCondition
#all, #blank_conditions?, #current_page, #each, #eager_load?, #expires_in, #find, #load, #loaded?, #merge!, #offset, #per_page, #reload, #to_hash, #to_query, #total_entries, #total_pages
Constructor Details
#initialize(klass, opts = {}) ⇒ PaginationCondition
Constructor - sets up the pagination options
19 20 21 22 23 |
# File 'lib/api_resource/conditions/pagination_condition.rb', line 19 def initialize(klass, opts = {}) @page = opts[:page] || 1 @per_page = opts[:per_page] || 10 super({ page: @page, per_page: @per_page }, klass) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ApiResource::Conditions::AbstractCondition
Instance Method Details
#paginated? ⇒ Boolean
Are we paginated?
29 30 31 |
# File 'lib/api_resource/conditions/pagination_condition.rb', line 29 def paginated? true end |