Class: Songkicky::Event
- Inherits:
-
Object
- Object
- Songkicky::Event
- Defined in:
- lib/event.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#festival ⇒ Object
Returns the value of attribute festival.
-
#headliners ⇒ Object
Returns the value of attribute headliners.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lng ⇒ Object
Returns the value of attribute lng.
-
#metro_area ⇒ Object
Returns the value of attribute metro_area.
-
#name ⇒ Object
Returns the value of attribute name.
-
#popularity ⇒ Object
Returns the value of attribute popularity.
-
#type ⇒ Object
Returns the value of attribute type.
-
#venue ⇒ Object
Returns the value of attribute venue.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(hash) ⇒ Event
Returns a new instance of Event.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/event.rb', line 18 def initialize(hash) @id = hash['id'] @type = hash['type'] @festival = Festival.new(hash['series']) if @type.downcase == 'festival' @name = hash['displayName'] @popularity = hash['popularity'] @date = Date.strptime(hash['start']['date'], '%Y-%m-%d') @lat = hash['location']['lat'] @lng = hash['location']['lng'] @venue = Venue.new(hash['venue']) @metro_area = MetroArea.new(hash['venue']['metroArea']) headlines = hash['performance'].select {|p| p['billing'] == 'headline'} @headliners = headlines.map {|p| Artist.find_by_name(p['artist']['displayName'])} end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
7 8 9 |
# File 'lib/event.rb', line 7 def date @date end |
#festival ⇒ Object
Returns the value of attribute festival.
7 8 9 |
# File 'lib/event.rb', line 7 def festival @festival end |
#headliners ⇒ Object
Returns the value of attribute headliners.
7 8 9 |
# File 'lib/event.rb', line 7 def headliners @headliners end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/event.rb', line 7 def id @id end |
#lat ⇒ Object
Returns the value of attribute lat.
7 8 9 |
# File 'lib/event.rb', line 7 def lat @lat end |
#lng ⇒ Object
Returns the value of attribute lng.
7 8 9 |
# File 'lib/event.rb', line 7 def lng @lng end |
#metro_area ⇒ Object
Returns the value of attribute metro_area.
7 8 9 |
# File 'lib/event.rb', line 7 def metro_area @metro_area end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/event.rb', line 7 def name @name end |
#popularity ⇒ Object
Returns the value of attribute popularity.
7 8 9 |
# File 'lib/event.rb', line 7 def popularity @popularity end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/event.rb', line 7 def type @type end |
#venue ⇒ Object
Returns the value of attribute venue.
7 8 9 |
# File 'lib/event.rb', line 7 def venue @venue end |