Class: Kippt::Favorite
- Inherits:
-
Object
- Object
- Kippt::Favorite
- Defined in:
- lib/kippt/favorite.rb
Instance Attribute Summary collapse
-
#clip ⇒ Object
readonly
Returns the value of attribute clip.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #collection_resource_class ⇒ Object
- #destroy ⇒ Object
- #id ⇒ Object
-
#initialize(clip, client) ⇒ Favorite
constructor
A new instance of Favorite.
- #save ⇒ Object
- #writable_attributes_hash ⇒ Object
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
#clip ⇒ Object (readonly)
Returns the value of attribute clip.
4 5 6 |
# File 'lib/kippt/favorite.rb', line 4 def clip @clip end |
#errors ⇒ Object (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_class ⇒ Object
16 17 18 |
# File 'lib/kippt/favorite.rb', line 16 def collection_resource_class Kippt::Favorites end |
#destroy ⇒ Object
33 34 35 |
# File 'lib/kippt/favorite.rb', line 33 def destroy collection_resource.destroy_resource(self) end |
#id ⇒ Object
12 13 14 |
# File 'lib/kippt/favorite.rb', line 12 def id nil end |
#save ⇒ Object
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_hash ⇒ Object
20 21 22 |
# File 'lib/kippt/favorite.rb', line 20 def writable_attributes_hash nil end |