Class: Ponto::Collection
- Inherits:
-
Array
- Object
- Array
- Ponto::Collection
- Defined in:
- lib/ponto/collection.rb
Instance Attribute Summary collapse
-
#after_cursor ⇒ Object
Returns the value of attribute after_cursor.
-
#before_cursor ⇒ Object
Returns the value of attribute before_cursor.
-
#first_link ⇒ Object
Returns the value of attribute first_link.
-
#latest_synchronization ⇒ Object
Returns the value of attribute latest_synchronization.
-
#next_link ⇒ Object
Returns the value of attribute next_link.
-
#page_limit ⇒ Object
Returns the value of attribute page_limit.
-
#previous_link ⇒ Object
Returns the value of attribute previous_link.
-
#synchronized_at ⇒ Object
Returns the value of attribute synchronized_at.
Instance Method Summary collapse
-
#initialize(klass:, items:, paging:, links:, synchronized_at:, latest_synchronization:) ⇒ Collection
constructor
A new instance of Collection.
- #inspect ⇒ Object
Constructor Details
#initialize(klass:, items:, paging:, links:, synchronized_at:, latest_synchronization:) ⇒ Collection
Returns a new instance of Collection.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ponto/collection.rb', line 12 def initialize( klass:, items:, paging:, links:, synchronized_at:, latest_synchronization: ) paging ||= {} links ||= {} @klass = klass @page_limit = paging["limit"] @before_cursor = paging["before"] @after_cursor = paging["after"] @first_link = links["first"] @next_link = links["next"] @previous_link = links["prev"] @synchronized_at = synchronized_at @latest_synchronization = latest_synchronization super(items) end |
Instance Attribute Details
#after_cursor ⇒ Object
Returns the value of attribute after_cursor.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def after_cursor @after_cursor end |
#before_cursor ⇒ Object
Returns the value of attribute before_cursor.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def before_cursor @before_cursor end |
#first_link ⇒ Object
Returns the value of attribute first_link.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def first_link @first_link end |
#latest_synchronization ⇒ Object
Returns the value of attribute latest_synchronization.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def latest_synchronization @latest_synchronization end |
#next_link ⇒ Object
Returns the value of attribute next_link.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def next_link @next_link end |
#page_limit ⇒ Object
Returns the value of attribute page_limit.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def page_limit @page_limit end |
#previous_link ⇒ Object
Returns the value of attribute previous_link.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def previous_link @previous_link end |
#synchronized_at ⇒ Object
Returns the value of attribute synchronized_at.
3 4 5 |
# File 'lib/ponto/collection.rb', line 3 def synchronized_at @synchronized_at end |
Instance Method Details
#inspect ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/ponto/collection.rb', line 34 def inspect result = "#<#{self.class.name}" instance_variables.each do |instance_variable| result +=" #{instance_variable}=#{instance_variable_get(instance_variable).inspect}" end result += ">" result end |