Class: Paymos::Page

Inherits:
Model
  • Object
show all
Defined in:
lib/paymos/models.rb,
sig/paymos.rbs

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Model

#[], deep_freeze, fields, #initialize, #to_h

Constructor Details

This class inherits a constructor from Paymos::Model

Instance Attribute Details

#itemsArray[Item] (readonly)

Returns the value of attribute items.

Returns:

  • (Array[Item])


146
147
148
# File 'sig/paymos.rbs', line 146

def items
  @items
end

#next_cursorString? (readonly)

Returns the value of attribute next_cursor.

Returns:

  • (String, nil)


147
148
149
# File 'sig/paymos.rbs', line 147

def next_cursor
  @next_cursor
end

Class Method Details

.from(value, item_type:) ⇒ Object

Raises:



137
138
139
140
141
142
# File 'lib/paymos/models.rb', line 137

def self.from(value, item_type:)
  model = super(value)
  raise Error, 'Paymos API page items must be an array' unless model.items.is_a?(Array)

  new(items: model.items.map { |item| item_type.from(item) }, next_cursor: model.next_cursor)
end