Class: FullCircle::UpcomingEventBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/full_circle/upcoming_event_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeUpcomingEventBuilder

Returns a new instance of UpcomingEventBuilder.



5
6
7
# File 'lib/full_circle/upcoming_event_builder.rb', line 5

def initialize
  @domain = "360durango.com"
end

Instance Method Details

#from_api_hash(hash) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/full_circle/upcoming_event_builder.rb', line 9

def from_api_hash(hash)
  @hash = hash
  result = OpenStruct.new({
    id: hash.fetch("id"),
    date: hash.fetch("date"),
    title: hash.fetch("title"),
    time: hash.fetch("time"),
    all_day_event: hash.fetch("allDayEvent"),
    date_mode: hash.fetch("dateMode"),
    site_id: hash.fetch("siteId"),
    type: hash.fetch("type"),

    image_url: hash.fetch("ad"){{}}.fetch("logoImage"){{}}["url"],
    end_date: hash["endDate"],
    expire_date: hash["expireDate"],
    end_time: hash["endTime"],
    description: hash["__content__"],
    ad_id: ad_id,
  })
end