Class: OracleHcm::ResourceList
- Defined in:
- lib/oracle_hcm/resource_list.rb
Overview
A ResourceList is a helper object that makes it easy to poll through paginated resources.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(data, offset, limit, method, resource, client, parent = nil) ⇒ ResourceList
constructor
A new instance of ResourceList.
- #items ⇒ Object
- #next ⇒ Object
Methods inherited from Resource
cached_property, #canonical_id, child_resource, #link, property, resource_name, #resource_name, #resource_url, #uri
Constructor Details
#initialize(data, offset, limit, method, resource, client, parent = nil) ⇒ ResourceList
Returns a new instance of ResourceList.
9 10 11 12 13 14 15 16 |
# File 'lib/oracle_hcm/resource_list.rb', line 9 def initialize(data, offset, limit, method, resource, client, parent = nil) super(data, client) @limit = limit @offset = offset @method = method @resource = resource @parent = parent end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/oracle_hcm/resource_list.rb', line 7 def client @client end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
7 8 9 |
# File 'lib/oracle_hcm/resource_list.rb', line 7 def limit @limit end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/oracle_hcm/resource_list.rb', line 7 def method @method end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
7 8 9 |
# File 'lib/oracle_hcm/resource_list.rb', line 7 def offset @offset end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
7 8 9 |
# File 'lib/oracle_hcm/resource_list.rb', line 7 def parent @parent end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
7 8 9 |
# File 'lib/oracle_hcm/resource_list.rb', line 7 def resource @resource end |
Instance Method Details
#items ⇒ Object
22 23 24 25 26 |
# File 'lib/oracle_hcm/resource_list.rb', line 22 def items @data.fetch("items").map { |item| resource.new(item, client, parent) } end |
#next ⇒ Object
18 19 20 |
# File 'lib/oracle_hcm/resource_list.rb', line 18 def next client.send(method, limit: limit, offset: offset + limit) end |