Class: Genius::Annotation

Inherits:
Resource show all
Defined in:
lib/genius/annotation.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#raw_response, #resource

Instance Method Summary collapse

Methods inherited from Resource

default_headers, default_params, find, from_hash, http_get, #initialize, #reload, resource_name

Constructor Details

This class inherits a constructor from Genius::Resource

Instance Attribute Details

#authorsObject (readonly)

Returns the value of attribute authors.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def authors
  @authors
end

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def body
  @body
end

#comment_countObject (readonly)

Returns the value of attribute comment_count.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def comment_count
  @comment_count
end

#current_user_metadataObject (readonly)

Returns the value of attribute current_user_metadata.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def 
  @current_user_metadata
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def id
  @id
end

#share_urlObject (readonly)

Returns the value of attribute share_url.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def share_url
  @share_url
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def state
  @state
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def url
  @url
end

#verified_byObject (readonly)

Returns the value of attribute verified_by.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def verified_by
  @verified_by
end

#votes_totalObject (readonly)

Returns the value of attribute votes_total.



3
4
5
# File 'lib/genius/annotation.rb', line 3

def votes_total
  @votes_total
end

Instance Method Details

#parse_resource!Object



6
7
8
9
10
11
12
13
14
15
16
17
# 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