Class: Ibanity::Collection
- Inherits:
-
Array
- Object
- Array
- Ibanity::Collection
- Defined in:
- lib/ibanity/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.
-
#last_link ⇒ Object
Returns the value of attribute last_link.
-
#latest_synchronization ⇒ Object
Returns the value of attribute latest_synchronization.
-
#next_link ⇒ Object
Returns the value of attribute next_link.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#page_limit ⇒ Object
Returns the value of attribute page_limit.
-
#page_number ⇒ Object
Returns the value of attribute page_number.
-
#page_size ⇒ Object
Returns the value of attribute page_size.
-
#previous_link ⇒ Object
Returns the value of attribute previous_link.
-
#synchronized_at ⇒ Object
Returns the value of attribute synchronized_at.
-
#total ⇒ Object
Returns the value of attribute total.
-
#total_entries ⇒ Object
Returns the value of attribute total_entries.
-
#total_pages ⇒ Object
Returns the value of attribute total_pages.
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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ibanity/collection.rb', line 19 def initialize( klass:, items:, paging:, links:, synchronized_at:, latest_synchronization: ) paging ||= {} links ||= {} @klass = klass @page_limit = paging["limit"] @page_number = paging["pageNumber"] @page_size = paging["pageSize"] @total_entries = paging["totalEntries"] @total_pages = paging["totalPages"] @before_cursor = paging["before"] @after_cursor = paging["after"] @offset = paging["offset"] @total = paging["total"] @first_link = links["first"] @next_link = links["next"] @previous_link = links["prev"] @last_link = links["last"] @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/ibanity/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/ibanity/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/ibanity/collection.rb', line 3 def first_link @first_link end |
#last_link ⇒ Object
Returns the value of attribute last_link.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def last_link @last_link end |
#latest_synchronization ⇒ Object
Returns the value of attribute latest_synchronization.
3 4 5 |
# File 'lib/ibanity/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/ibanity/collection.rb', line 3 def next_link @next_link end |
#offset ⇒ Object
Returns the value of attribute offset.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def offset @offset end |
#page_limit ⇒ Object
Returns the value of attribute page_limit.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def page_limit @page_limit end |
#page_number ⇒ Object
Returns the value of attribute page_number.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def page_number @page_number end |
#page_size ⇒ Object
Returns the value of attribute page_size.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def page_size @page_size end |
#previous_link ⇒ Object
Returns the value of attribute previous_link.
3 4 5 |
# File 'lib/ibanity/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/ibanity/collection.rb', line 3 def synchronized_at @synchronized_at end |
#total ⇒ Object
Returns the value of attribute total.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def total @total end |
#total_entries ⇒ Object
Returns the value of attribute total_entries.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def total_entries @total_entries end |
#total_pages ⇒ Object
Returns the value of attribute total_pages.
3 4 5 |
# File 'lib/ibanity/collection.rb', line 3 def total_pages @total_pages end |
Instance Method Details
#inspect ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/ibanity/collection.rb', line 48 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 |