Class: Active::Services::ActiveWorks
Instance Attribute Summary collapse
Attributes inherited from IActivity
#data, #online_registration
Class Method Summary
collapse
-
.find_by_id(id) ⇒ Object
EXAMPLE lazy load the data for some_crazy_method def some_crazy return @some_crazy unless @some_crazy.nil? @some_crazy = @data.split replace twist bla bla bla end.
Instance Method Summary
collapse
Methods inherited from IActivity
#validated_address
Constructor Details
#initialize(data = {}) ⇒ ActiveWorks
Returns a new instance of ActiveWorks.
13
14
15
16
17
18
19
|
# File 'lib/services/active_works.rb', line 13
def initialize(data={})
@data = HashWithIndifferentAccess.new(data) || HashWithIndifferentAccess.new
@api_data_loaded = false
@asset_type_id = "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1"
get_app_api
end
|
Instance Attribute Details
#asset_type_id ⇒ Object
Returns the value of attribute asset_type_id.
11
12
13
|
# File 'lib/services/active_works.rb', line 11
def asset_type_id
@asset_type_id
end
|
Class Method Details
.find_by_id(id) ⇒ Object
EXAMPLE lazy load the data for some_crazy_method def some_crazy
return @some_crazy unless @some_crazy.nil?
@some_crazy = @data[:some_crazy_method_from_ats].split replace twist bla bla bla
end
116
117
118
|
# File 'lib/services/active_works.rb', line 116
def self.find_by_id(id)
return ActiveWorks.new({:id=>id})
end
|
Instance Method Details
#address ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'lib/services/active_works.rb', line 58
def address
@address = validated_address({
:address => @data["eventDetailDto"]["addressLine1"],
:city => @data["eventDetailDto"]["addressCity"],
:state => @data["eventDetailDto"]["state"],
:zip => @data["eventDetailDto"]["addressPostalCode"],
:country => @data["eventDetailDto"]["countryName"]
})
end
|
#asset_id ⇒ Object
25
26
27
28
29
|
# File 'lib/services/active_works.rb', line 25
def asset_id
if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("id")
@data["eventDetailDto"]["id"]
end
end
|
#categories ⇒ Object
50
51
52
|
# File 'lib/services/active_works.rb', line 50
def categories
[@data["eventDetailDto"]["channels"]]
end
|
#category ⇒ Object
97
98
99
|
# File 'lib/services/active_works.rb', line 97
def category
primary_category
end
|
88
89
90
|
# File 'lib/services/active_works.rb', line 88
def contact_email
nil
end
|
84
85
86
|
# File 'lib/services/active_works.rb', line 84
def contact_name
nil
end
|
#desc ⇒ Object
101
102
103
104
105
106
|
# File 'lib/services/active_works.rb', line 101
def desc
if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("description")
sanitize @data["eventDetailDto"]["description"]
end
end
|
#end_date ⇒ Object
76
77
78
|
# File 'lib/services/active_works.rb', line 76
def end_date
DateTime.parse @data["eventDetailDto"]["endDateTime"] if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("endDateTime")
end
|
#end_time ⇒ Object
80
81
82
|
# File 'lib/services/active_works.rb', line 80
def end_time
end_date
end
|
#event_image_url ⇒ Object
38
39
40
41
42
|
# File 'lib/services/active_works.rb', line 38
def event_image_url
if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("logoUrl")
@data["eventDetailDto"]["logoUrl"]
end
end
|
#primary_category ⇒ Object
54
55
56
|
# File 'lib/services/active_works.rb', line 54
def primary_category
categories.first
end
|
#source ⇒ Object
21
22
23
|
# File 'lib/services/active_works.rb', line 21
def source
:active_works
end
|
#start_date ⇒ Object
68
69
70
|
# File 'lib/services/active_works.rb', line 68
def start_date
DateTime.parse @data["eventDetailDto"]["startDateTimeWithTZ"] if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("startDateTimeWithTZ")
end
|
#start_time ⇒ Object
72
73
74
|
# File 'lib/services/active_works.rb', line 72
def start_time
start_date
end
|
#title ⇒ Object
32
33
34
35
36
|
# File 'lib/services/active_works.rb', line 32
def title
if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("name")
@data["eventDetailDto"]["name"]
end
end
|
#url ⇒ Object
44
45
46
47
48
|
# File 'lib/services/active_works.rb', line 44
def url
if @data.has_key?("eventDetailDto") && @data["eventDetailDto"].has_key?("registrationUrl")
@data["eventDetailDto"]["registrationUrl"]
end
end
|
#user ⇒ Object
92
93
94
|
# File 'lib/services/active_works.rb', line 92
def user
User.new
end
|