Class: Kippt::Clip

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

Instance Method Summary collapse

Methods included from Resource

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

Instance Method Details

#all_comments_embedded?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/kippt/clip.rb', line 43

def all_comments_embedded?
  comments_count == comments_data.size
end

#all_likes_embedded?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/kippt/clip.rb', line 59

def all_likes_embedded?
  likes_count == likes_data.size
end

#collection_resource_classObject



27
28
29
# File 'lib/kippt/clip.rb', line 27

def collection_resource_class
  Kippt::RootClips
end

#commentsObject



39
40
41
# File 'lib/kippt/clip.rb', line 39

def comments
  Kippt::Comments.new(client, self)
end

#comments_countObject



47
48
49
# File 'lib/kippt/clip.rb', line 47

def comments_count
  attributes.comments["count"]
end

#comments_dataObject



51
52
53
# File 'lib/kippt/clip.rb', line 51

def comments_data
  attributes.comments["data"]
end

#favoriteObject



91
92
93
# File 'lib/kippt/clip.rb', line 91

def favorite
  Kippt::Favorite.new(self, client).save
end

#likeObject



83
84
85
# File 'lib/kippt/clip.rb', line 83

def like
  Kippt::Like.new(self, client).save
end

#likesObject



55
56
57
# File 'lib/kippt/clip.rb', line 55

def likes
  Kippt::ClipLikes.new(client, self)
end

#likes_countObject



63
64
65
# File 'lib/kippt/clip.rb', line 63

def likes_count
  attributes.likes["count"]
end

#likes_dataObject



67
68
69
# File 'lib/kippt/clip.rb', line 67

def likes_data
  attributes.likes["data"]
end

#list_uriObject



31
32
33
34
35
36
37
# File 'lib/kippt/clip.rb', line 31

def list_uri
  if attributes.list.is_a? String
    attributes.list
  else
    list.resource_uri
  end
end

#savesObject



71
72
73
# File 'lib/kippt/clip.rb', line 71

def saves
  Kippt::Saves.new(client, self)
end

#saves_countObject



75
76
77
# File 'lib/kippt/clip.rb', line 75

def saves_count
  attributes.saves["count"]
end

#saves_dataObject



79
80
81
# File 'lib/kippt/clip.rb', line 79

def saves_data
  attributes.saves["data"]
end

#unfavoriteObject



95
96
97
# File 'lib/kippt/clip.rb', line 95

def unfavorite
  Kippt::Favorite.new(self, client).destroy
end

#unlikeObject



87
88
89
# File 'lib/kippt/clip.rb', line 87

def unlike
  Kippt::Like.new(self, client).destroy
end