class Genius::Annotation
Attributes
body[R]
comment_count[R]
current_user_metadata[R]
id[R]
state[R]
url[R]
verified_by[R]
votes_total[R]
Public Class Methods
create!(body = {})
click to toggle source
# File lib/genius/annotation.rb, line 54 def self.create!(body = {}) new(http_post("/annotations", body: body, headers: default_headers)) end
Public Instance Methods
destroy!()
click to toggle source
# File lib/genius/annotation.rb, line 27 def destroy! self.class.http_delete("/annotations/#{id}", headers: self.class.default_headers) true end
downvote!()
click to toggle source
# File lib/genius/annotation.rb, line 47 def downvote! self.class.http_put("/annotations/#{id}/downvote", headers: self.class.default_headers) true end
parse_resource!()
click to toggle source
# File lib/genius/annotation.rb, line 6 def parse_resource! @verified_by = Account.from_hash(resource["verified_by"]) @share_url = resource["share_url"] @body = formatted_attribute("body") @votes_total = resource["votes_total"] @comment_count = resource["comment_count"] @authors = resource["authors"] @state = resource["state"] @current_user_metadata = resource["current_user_metadata"] @id = resource["id"] @url = resource["url"] end
unvote!()
click to toggle source
# File lib/genius/annotation.rb, line 40 def unvote! self.class.http_put("/annotations/#{id}/unvote", headers: self.class.default_headers) true end
update!(body = {})
click to toggle source
# File lib/genius/annotation.rb, line 19 def update!(body = {}) response = self.class.http_put("/annotations/#{id}", body: body, headers: self.class.default_headers) self.class.new(response, text_format: text_format) end
upvote!()
click to toggle source
# File lib/genius/annotation.rb, line 33 def upvote! self.class.http_put("/annotations/#{id}/upvote", headers: self.class.default_headers) true end