Class: ACTV::SubEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/actv/sub_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#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

Instance Attribute Details

#end_dateObject

Returns the value of attribute end_date.



3
4
5
# File 'lib/actv/sub_event.rb', line 3

def end_date
  @end_date
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/actv/sub_event.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/actv/sub_event.rb', line 3

def name
  @name
end

#start_dateObject

Returns the value of attribute start_date.



3
4
5
# File 'lib/actv/sub_event.rb', line 3

def start_date
  @start_date
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/actv/sub_event.rb', line 3

def url
  @url
end