Class: Genius::Artist
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tracking_paths ⇒ Object
readonly
Returns the value of attribute tracking_paths.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Attributes inherited from Resource
Instance Method Summary collapse
Methods inherited from Resource
default_headers, default_params, find, from_hash, handle_response, http_delete, http_get, http_post, http_put, #initialize, #reload, resource_name
Constructor Details
This class inherits a constructor from Genius::Resource
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def id @id end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def image_url @image_url end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def name @name end |
#tracking_paths ⇒ Object (readonly)
Returns the value of attribute tracking_paths.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def tracking_paths @tracking_paths end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def url @url end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
3 4 5 |
# File 'lib/genius/artist.rb', line 3 def user @user end |
Instance Method Details
#parse_resource! ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/genius/artist.rb', line 5 def parse_resource! @id = resource["id"] @name = resource["name"] @image_url = resource["image_url"] @url = resource["url"] @user = Account.from_hash(resource["user"]) @description = formatted_attribute("description") @tracking_paths = resource["tracking_paths"] end |
#songs(params: {}, headers: {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/genius/artist.rb', line 15 def songs(params: {}, headers: {}) headers = self.class.default_headers.merge(headers) params = self.class.default_params.merge(id: id).merge(params) response = self.class.http_get("/#{resource_name}s/#{id}/songs", query: params, headers: headers) response.parsed_response["response"]["songs"].map do |song| Song.from_hash(song, text_format: text_format) end end |