Class: Kippt::List

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/kippt/list.rb

Instance Method Summary collapse

Methods included from Resource

#destroy, included, #initialize, #save, #writable_attributes_hash

Instance Method Details

#clipsObject



24
25
26
# File 'lib/kippt/list.rb', line 24

def clips
  Kippt::Clips.new(client, "lists/#{id}/clips")
end

#collaboratorsObject



18
19
20
21
22
# File 'lib/kippt/list.rb', line 18

def collaborators
  attributes.collaborators["data"].map {|collborator_data|
    Kippt::User.new(collborator_data, client)
  }
end

#collection_resource_classObject



14
15
16
# File 'lib/kippt/list.rb', line 14

def collection_resource_class
  Kippt::Lists
end

#followObject

Raises:



34
35
36
37
38
# File 'lib/kippt/list.rb', line 34

def follow
  response = client.post("#{resource_uri}relationship", :data => {:action => "follow"})
  raise Kippt::APIError.new("There was an error with the request: #{response.body["message"]}") unless response.success?
  response.success?
end

#following?Boolean

Returns:

  • (Boolean)

Raises:



28
29
30
31
32
# File 'lib/kippt/list.rb', line 28

def following?
  response = client.get("#{resource_uri}relationship")
  raise Kippt::APIError.new("There was an error with the request: #{response.body["message"]}") unless response.success?
  response.body["following"]
end

#unfollowObject

Raises:



40
41
42
43
44
# File 'lib/kippt/list.rb', line 40

def unfollow
  response = client.post("#{resource_uri}relationship", :data => {:action => "unfollow"})
  raise Kippt::APIError.new("There was an error with the request: #{response.body["message"]}") unless response.success?
  response.success?
end