Class: Firstfm::Event
- Inherits:
-
Object
- Object
- Firstfm::Event
- Defined in:
- lib/firstfm/event.rb
Instance Attribute Summary collapse
-
#artists ⇒ Object
Returns the value of attribute artists.
-
#attendance ⇒ Object
Returns the value of attribute attendance.
-
#description ⇒ Object
Returns the value of attribute description.
-
#headliner ⇒ Object
Returns the value of attribute headliner.
-
#id ⇒ Object
Returns the value of attribute id.
-
#images ⇒ Object
Returns the value of attribute images.
-
#reviews ⇒ Object
Returns the value of attribute reviews.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
-
#venue ⇒ Object
Returns the value of attribute venue.
-
#website ⇒ Object
Returns the value of attribute website.
Class Method Summary collapse
Instance Attribute Details
#artists ⇒ Object
Returns the value of attribute artists.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def artists @artists end |
#attendance ⇒ Object
Returns the value of attribute attendance.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def attendance @attendance end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def description @description end |
#headliner ⇒ Object
Returns the value of attribute headliner.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def headliner @headliner end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def id @id end |
#images ⇒ Object
Returns the value of attribute images.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def images @images end |
#reviews ⇒ Object
Returns the value of attribute reviews.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def reviews @reviews end |
#start_date ⇒ Object
Returns the value of attribute start_date.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def start_date @start_date end |
#tag ⇒ Object
Returns the value of attribute tag.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def tag @tag end |
#tags ⇒ Object
Returns the value of attribute tags.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def url @url end |
#venue ⇒ Object
Returns the value of attribute venue.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def venue @venue end |
#website ⇒ Object
Returns the value of attribute website.
5 6 7 |
# File 'lib/firstfm/event.rb', line 5 def website @website end |
Class Method Details
.init_event_from_hash(hash) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/firstfm/event.rb', line 17 def self.init_event_from_hash(hash) return nil unless hash.is_a?(Hash) event = Event.new event.id = hash["id"] event.title = hash["title"] event.url = hash["url"] event.tag = hash["tag"] event.venue = Venue.init_venue_from_hash(hash["venue"]) event.description = hash["description"] event.attendance = hash["attendance"] event.reviews = hash["reviews"] event.website = hash["website"] event.start_date = hash['startDate'] event.artists = hash['artists']['artist'] if hash['artists'] event.headliner = hash['artists']['headliner'] if hash['artists'] event. = hash["tags"]["tag"] if hash["tags"] event.images = hash["image"] event end |
.init_events_from_hash(hash) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/firstfm/event.rb', line 7 def self.init_events_from_hash(hash) return [] unless hash["events"] && hash["events"]["event"] return [init_event_from_hash(hash["events"]["event"])] if hash["events"]["event"].is_a?(Hash) hash["events"]["event"].inject([]) do |arr, venue_hash| arr << init_event_from_hash(venue_hash) arr end end |