Method: ACTV::SubEvent#initialize

Defined in:
lib/actv/sub_event.rb

#initialize(hsh) ⇒ SubEvent

Returns a new instance of SubEvent.



5
6
7
8
9
10
11
12
# File 'lib/actv/sub_event.rb', line 5

def initialize hsh
  @id = hsh[:assetGuid]
  @name = hsh[:assetName]
  @start_date = Time.parse(hsh.fetch(:activityStartDate, "1970-01-01T00:00:00"))
  @end_date = Time.parse(hsh.fetch(:activityEndDate, "1970-01-01T00:00:00"))
  url = hsh.fetch(:assetSeoUrls, []).first || {}
  @url = url.fetch :urlAdr, "http://www.active.com/asset_service/#{@id}"
end