Module: Kippt::ReadCollectionResource

Includes:
Helpers
Included in:
ClipLikes, CollectionResource, Followers, Following, UserLikes, Users
Defined in:
lib/kippt/read_collection_resource.rb

Instance Method Summary collapse

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, options = {})
  response = client.get("#{base_uri}/#{resource_id}", options)
  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(options = {})
  validate_collection_options(options)

  collection_class.new(client.get(base_uri, options).body, client)
end