Class: Textmagic::REST::PaginateResource
- Inherits:
-
Object
- Object
- Textmagic::REST::PaginateResource
- Includes:
- Utils
- Defined in:
- lib/textmagic-ruby/rest/paginate_resource.rb
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#page_count ⇒ Object
readonly
Returns the value of attribute page_count.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
-
#initialize(path, client, params = {}, resource_class = nil) ⇒ PaginateResource
constructor
A new instance of PaginateResource.
Methods included from Utils
#key_map, #resource, #to_camel_case, #to_underscore_case
Constructor Details
#initialize(path, client, params = {}, resource_class = nil) ⇒ PaginateResource
Returns a new instance of PaginateResource.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/textmagic-ruby/rest/paginate_resource.rb', line 7 def initialize(path, client, params={}, resource_class=nil) @path = path @client = client %w(page limit pageCount).each do |attr| self.instance_variable_set("@#{to_underscore_case(attr)}", params.fetch(attr)) end @resources = Array.new params['resources'].each do |r| @resources << resource_class.new(@path, @client, r) end if resource_class end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
6 7 8 |
# File 'lib/textmagic-ruby/rest/paginate_resource.rb', line 6 def limit @limit end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
6 7 8 |
# File 'lib/textmagic-ruby/rest/paginate_resource.rb', line 6 def page @page end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count.
6 7 8 |
# File 'lib/textmagic-ruby/rest/paginate_resource.rb', line 6 def page_count @page_count end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
6 7 8 |
# File 'lib/textmagic-ruby/rest/paginate_resource.rb', line 6 def resources @resources end |