Module: Kippt::ReadCollectionResource
- Includes:
- Helpers
- Defined in:
- lib/kippt/read_collection_resource.rb
Instance Method Summary collapse
-
#[](resource_id, options = {}) ⇒ Object
(also: #find)
For certain objects you can get extra data by giving option ‘include_data`.
-
#fetch(options = {}) ⇒ Object
(also: #all)
For certain objects you can get extra data by giving option ‘include_data`.
Instance Method Details
#[](resource_id, options = {}) ⇒ Object Also known as: find
For certain objects you can get extra data by giving option ‘include_data`. For example with clips you can add `include_data: “list,via”`.
16 17 18 19 20 21 22 23 |
# File 'lib/kippt/read_collection_resource.rb', line 16 def [](resource_id, = {}) response = client.get("#{base_uri}/#{resource_id}", ) if response.success? object_class.new(response.body, client) else raise Kippt::APIError.new("Resource could not be loaded: #{response.body["message"]}") end end |
#fetch(options = {}) ⇒ Object Also known as: all
For certain objects you can get extra data by giving option ‘include_data`. For example with clips you can add `include_data: “list,via”`.
6 7 8 9 10 |
# File 'lib/kippt/read_collection_resource.rb', line 6 def fetch( = {}) () collection_class.new(client.get(base_uri, ).body, client) end |