Class: Hoolp::Resource::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/hoolp/resource/event.rb

Constant Summary collapse

MEDIA_BASE_URL =
"http://hooolp.com".freeze

Instance Method Summary collapse

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

#descriptionObject



24
25
26
# File 'lib/hoolp/resource/event.rb', line 24

def description
  @raw_event.fetch("addText")
end

#genresObject



34
35
36
# File 'lib/hoolp/resource/event.rb', line 34

def genres
  @raw_event.fetch("genresCsv").split(",").map(&:strip)
end

#idObject



12
13
14
# File 'lib/hoolp/resource/event.rb', line 12

def id
  @raw_event.fetch("id")
end

#image_urlsObject



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_atObject



16
17
18
# File 'lib/hoolp/resource/event.rb', line 16

def starts_at
  Time.parse(@raw_event.fetch("startDate")).utc
end

#titleObject



20
21
22
# File 'lib/hoolp/resource/event.rb', line 20

def title
  @raw_event.fetch("acts")
end