Class: Evtfl::Artist
- Inherits:
-
Object
- Object
- Evtfl::Artist
- Defined in:
- lib/evtfl/artist.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#short_bio ⇒ Object
readonly
Returns the value of attribute short_bio.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #concerts ⇒ Object
-
#initialize(args = {}) ⇒ Artist
constructor
A new instance of Artist.
Constructor Details
#initialize(args = {}) ⇒ Artist
Returns a new instance of Artist.
20 21 22 23 24 25 |
# File 'lib/evtfl/artist.rb', line 20 def initialize(args = {}) @name = args['name'] @short_bio = args['short_bio'] @id = args['id'] @url = args['url'] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
18 19 20 |
# File 'lib/evtfl/artist.rb', line 18 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/evtfl/artist.rb', line 18 def name @name end |
#short_bio ⇒ Object (readonly)
Returns the value of attribute short_bio.
18 19 20 |
# File 'lib/evtfl/artist.rb', line 18 def short_bio @short_bio end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
18 19 20 |
# File 'lib/evtfl/artist.rb', line 18 def url @url end |
Class Method Details
.search(name) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/evtfl/artist.rb', line 7 def self.search(name) url = "#{PRE}/search?app_key=#{Evtfl.api_key}&keywords=#{name}" uri = URI(url) response = Net::HTTP.get(uri) result = JSON.parse(response) # "A valid application key is required." return result['description'] if result['status'] == 'Authentication Error' return result['description'] if result['status'] == 'Missing parameter' new(result['performers']['performer'][0]) end |