Class: Kippt::Favorite

Inherits:
Object
  • Object
show all
Defined in:
lib/kippt/favorite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clip, client) ⇒ Favorite

Returns a new instance of Favorite.



6
7
8
9
10
# File 'lib/kippt/favorite.rb', line 6

def initialize(clip, client)
  @client = client
  @errors = []
  @clip   = clip
end

Instance Attribute Details

#clipObject (readonly)

Returns the value of attribute clip.



4
5
6
# File 'lib/kippt/favorite.rb', line 4

def clip
  @clip
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/kippt/favorite.rb', line 4

def errors
  @errors
end

Instance Method Details

#collection_resource_classObject



16
17
18
# File 'lib/kippt/favorite.rb', line 16

def collection_resource_class
  Kippt::Favorites
end

#destroyObject



33
34
35
# File 'lib/kippt/favorite.rb', line 33

def destroy
  collection_resource.destroy_resource(self)
end

#idObject



12
13
14
# File 'lib/kippt/favorite.rb', line 12

def id
  nil
end

#saveObject



24
25
26
27
28
29
30
31
# File 'lib/kippt/favorite.rb', line 24

def save
  @errors = []
  response = collection_resource.save_resource(self)
  if response[:error_message]
    errors << response[:error_message]
  end
  response[:success]
end

#writable_attributes_hashObject



20
21
22
# File 'lib/kippt/favorite.rb', line 20

def writable_attributes_hash
  nil
end