Class: Evtfl::Concerts

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Concerts

Returns a new instance of Concerts.



15
16
17
18
19
20
21
# File 'lib/evtfl/concerts.rb', line 15

def initialize(args = {})
  @country = args['country']
  @city    = args['city']
  @url     = args['url']
  @title   = args['title']
  @id      = args['id']
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



13
14
15
# File 'lib/evtfl/concerts.rb', line 13

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



13
14
15
# File 'lib/evtfl/concerts.rb', line 13

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'lib/evtfl/concerts.rb', line 13

def id
  @id
end

#titleObject (readonly)

Returns the value of attribute title.



13
14
15
# File 'lib/evtfl/concerts.rb', line 13

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



13
14
15
# File 'lib/evtfl/concerts.rb', line 13

def url
  @url
end

Class Method Details

.list(id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/evtfl/concerts.rb', line 5

def self.list(id)
  url = "#{PRE}/events/list?app_key=#{Evtfl.api_key}&id=#{id}&page_size=100"
  uri = URI(url)
  response = Net::HTTP.get(uri)
  result = JSON.parse(response)
  result['event'].map { |show| new(show) }
end