Class: Ponto::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/ponto/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_cursorObject

Returns the value of attribute after_cursor.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def after_cursor
  @after_cursor
end

#before_cursorObject

Returns the value of attribute before_cursor.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def before_cursor
  @before_cursor
end

Returns the value of attribute first_link.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def first_link
  @first_link
end

#latest_synchronizationObject

Returns the value of attribute latest_synchronization.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def latest_synchronization
  @latest_synchronization
end

Returns the value of attribute next_link.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def next_link
  @next_link
end

#page_limitObject

Returns the value of attribute page_limit.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def page_limit
  @page_limit
end

Returns the value of attribute previous_link.



3
4
5
# File 'lib/ponto/collection.rb', line 3

def previous_link
  @previous_link
end

#synchronized_atObject

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

#inspectObject



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