Class: PayPro::List
- Inherits:
-
Entity
show all
- Includes:
- Enumerable
- Defined in:
- lib/pay_pro/entities/list.rb
Instance Attribute Summary collapse
Attributes inherited from Entity
#api_client
Instance Method Summary
collapse
Methods inherited from Entity
create_from_data, #initialize, #inspect
Constructor Details
This class inherits a constructor from PayPro::Entity
Instance Attribute Details
#filters ⇒ Object
Returns the value of attribute filters.
7
8
9
|
# File 'lib/pay_pro/entities/list.rb', line 7
def filters
@filters
end
|
Instance Method Details
#[](key) ⇒ Object
9
10
11
|
# File 'lib/pay_pro/entities/list.rb', line 9
def [](key)
data[key]
end
|
#each(&block) ⇒ Object
13
14
15
|
# File 'lib/pay_pro/entities/list.rb', line 13
def each(&block)
data.each(&block)
end
|
#empty? ⇒ Boolean
35
36
37
|
# File 'lib/pay_pro/entities/list.rb', line 35
def empty?
data.empty?
end
|
#next(params: {}) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/pay_pro/entities/list.rb', line 17
def next(params: {})
return List.create_from_data({ data: [] }, api_client: api_client) if next_link.nil?
params = filters.merge(params).merge(cursor: next_id)
response = api_client.request(method: 'get', uri: next_uri.path, params: params)
Util.to_entity(response.data, api_client: api_client)
end
|
#previous(params: {}) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/pay_pro/entities/list.rb', line 26
def previous(params: {})
return List.create_from_data({ data: [] }, api_client: api_client) if previous_link.nil?
params = filters.merge(params).merge(cursor: previous_id)
response = api_client.request(method: 'get', uri: previous_uri.path, params: params)
Util.to_entity(response.data, api_client: api_client)
end
|