Class: OmiseGO::List
- Inherits:
-
Base
- Object
- Base
- OmiseGO::List
show all
- Defined in:
- lib/omisego/list.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #original_payload
Instance Method Summary
collapse
Methods inherited from Base
attributes, #error?, global_client, #initialize, #inspect, request, #success?
Constructor Details
This class inherits a constructor from OmiseGO::Base
Instance Method Details
#[](i) ⇒ Object
13
14
15
|
# File 'lib/omisego/list.rb', line 13
def [](i)
data[i]
end
|
#data ⇒ Object
23
24
25
26
27
28
|
# File 'lib/omisego/list.rb', line 23
def data
@_data ||= @data.map do |element|
klass = @client.config[:models][element['object'].to_sym]
klass.new(element, client: @client)
end
end
|
#first ⇒ Object
5
6
7
|
# File 'lib/omisego/list.rb', line 5
def first
data.first
end
|
#last ⇒ Object
9
10
11
|
# File 'lib/omisego/list.rb', line 9
def last
data.last
end
|
17
18
19
20
21
|
# File 'lib/omisego/list.rb', line 17
def
@_pagination ||= if (pag = @original_payload['pagination'])
Pagination.new(pag)
end
end
|