Class: Hoolp::Resource::Event
- Inherits:
-
Object
- Object
- Hoolp::Resource::Event
- Defined in:
- lib/hoolp/resource/event.rb
Constant Summary collapse
- MEDIA_BASE_URL =
"http://hooolp.com".freeze
Instance Method Summary collapse
- #description ⇒ Object
- #genres ⇒ Object
- #id ⇒ Object
- #image_urls ⇒ Object
-
#initialize(raw_event) ⇒ Event
constructor
A new instance of Event.
- #starts_at ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(raw_event) ⇒ Event
Returns a new instance of Event.
8 9 10 |
# File 'lib/hoolp/resource/event.rb', line 8 def initialize(raw_event) @raw_event = raw_event end |
Instance Method Details
#description ⇒ Object
24 25 26 |
# File 'lib/hoolp/resource/event.rb', line 24 def description @raw_event.fetch("addText") end |
#genres ⇒ Object
34 35 36 |
# File 'lib/hoolp/resource/event.rb', line 34 def genres @raw_event.fetch("genresCsv").split(",").map(&:strip) end |
#id ⇒ Object
12 13 14 |
# File 'lib/hoolp/resource/event.rb', line 12 def id @raw_event.fetch("id") end |
#image_urls ⇒ Object
28 29 30 31 32 |
# File 'lib/hoolp/resource/event.rb', line 28 def image_urls @raw_event.fetch("bandFotos").map do |image_path| [MEDIA_BASE_URL, image_path].join end end |
#starts_at ⇒ Object
16 17 18 |
# File 'lib/hoolp/resource/event.rb', line 16 def starts_at Time.parse(@raw_event.fetch("startDate")).utc end |
#title ⇒ Object
20 21 22 |
# File 'lib/hoolp/resource/event.rb', line 20 def title @raw_event.fetch("acts") end |