Class: Evtfl::Artist

Inherits:
Object
  • Object
show all
Defined in:
lib/evtfl/artist.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



18
19
20
# File 'lib/evtfl/artist.rb', line 18

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/evtfl/artist.rb', line 18

def name
  @name
end

#short_bioObject (readonly)

Returns the value of attribute short_bio.



18
19
20
# File 'lib/evtfl/artist.rb', line 18

def short_bio
  @short_bio
end

#urlObject (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

Instance Method Details

#concertsObject



27
28
29
# File 'lib/evtfl/artist.rb', line 27

def concerts
  Evtfl::Concerts.list(id)
end