Class: Kippt::Likes

Inherits:
Object
  • Object
show all
Includes:
CollectionResource
Defined in:
lib/kippt/likes.rb

Overview

This class is only meant to be used by Kippt::Like class for liking and unliking clips.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CollectionResource

#build, #create, #save_resource

Methods included from ReadCollectionResource

#[], #fetch

Constructor Details

#initialize(client, clip) ⇒ Likes

Returns a new instance of Likes.



8
9
10
11
# File 'lib/kippt/likes.rb', line 8

def initialize(client, clip)
  @client = client
  @clip   = clip
end

Instance Attribute Details

#clipObject (readonly)

Returns the value of attribute clip.



6
7
8
# File 'lib/kippt/likes.rb', line 6

def clip
  @clip
end

Instance Method Details

#base_uriObject



13
14
15
# File 'lib/kippt/likes.rb', line 13

def base_uri
  "clips/#{clip.id}/likes"
end

#destroy_resource(resource) ⇒ Object



17
18
19
# File 'lib/kippt/likes.rb', line 17

def destroy_resource(resource)
  client.delete(base_uri).success?
end