Class: ACTV::Asset
Instance Attribute Summary collapse
Attributes inherited from Base
#attrs
Instance Method Summary
collapse
-
#activenet? ⇒ Boolean
-
#attribute_paths ⇒ Object
-
#attributes ⇒ Object
-
#awcamps30? ⇒ Boolean
-
#awcamps? ⇒ Boolean
-
#awendurance? ⇒ Boolean
-
#awsports? ⇒ Boolean
-
#channels ⇒ Object
(also: #asset_channels, #assetChannels)
-
#components ⇒ Object
(also: #asset_components, #assetComponents)
-
#description ⇒ Object
-
#description_by_type(type) ⇒ Object
-
#descriptions ⇒ Object
(also: #asset_descriptions, #assetDescriptions)
-
#endurance_id ⇒ Object
-
#evergreen? ⇒ Boolean
-
#first_topic ⇒ Object
(also: #topic)
-
#first_topic_name ⇒ Object
-
#first_topic_path ⇒ Object
-
#has_location? ⇒ Boolean
-
#image ⇒ Object
-
#image_by_name(name) ⇒ Object
-
#image_path ⇒ Object
-
#image_with_placeholder ⇒ Object
-
#images ⇒ Object
(also: #asset_images, #assetImages)
-
#is_article? ⇒ Boolean
-
#is_event? ⇒ Boolean
-
#kids? ⇒ Boolean
-
#legacy_data ⇒ Object
(also: #asset_legacy_data, #assetLegacyData)
-
#location_path ⇒ Object
-
#media_url ⇒ Object
-
#meta_interest_paths ⇒ Object
-
#meta_interests ⇒ Object
-
#org_timezone ⇒ Object
-
#place ⇒ Object
-
#place_timezone ⇒ Object
-
#prices ⇒ Object
(also: #asset_prices, #assetPrices)
-
#recurrences ⇒ Object
-
#regcenter2? ⇒ Boolean
-
#regcenter? ⇒ Boolean
-
#registration_status ⇒ Object
(also: #reg_status)
-
#seo_url(systemName = 'as3') ⇒ Object
-
#seo_urls ⇒ Object
(also: #asset_seo_urls, #assetSeoUrls)
-
#status ⇒ Object
(also: #asset_status, #assetStatus)
-
#sub_2_topic ⇒ Object
-
#sub_2_topic_path ⇒ Object
-
#sub_3_topic ⇒ Object
-
#sub_3_topic_path ⇒ Object
-
#sub_4_topic ⇒ Object
-
#sub_4_topic_path ⇒ Object
-
#sub_topic ⇒ Object
-
#sub_topic_path ⇒ Object
-
#summary ⇒ Object
-
#tag_by_description(description) ⇒ Object
-
#tags ⇒ Object
(also: #asset_tags, #assetTags)
-
#thriva? ⇒ Boolean
-
#topics ⇒ Object
(also: #asset_topics, #assetTopics)
-
#version ⇒ Object
-
#visible? ⇒ Boolean
Methods inherited from Identity
#==, #initialize
Methods inherited from Base
#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, from_response, #initialize, #memoize, #method_missing, object_attr_reader, #respond_to?, #to_hash, uri_attr_reader
Constructor Details
This class inherits a constructor from ACTV::Identity
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class ACTV::Base
Instance Attribute Details
#activityEndDate ⇒ Object
Also known as:
end_date, activity_end_date
Returns the value of attribute activityEndDate.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def activityEndDate
@activityEndDate
end
|
#activityEndTime ⇒ Object
Also known as:
end_time
Returns the value of attribute activityEndTime.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def activityEndTime
@activityEndTime
end
|
#activityStartDate ⇒ Object
Also known as:
start_date, activity_start_date
Returns the value of attribute activityStartDate.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def activityStartDate
@activityStartDate
end
|
#activityStartTime ⇒ Object
Also known as:
start_time
Returns the value of attribute activityStartTime.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def activityStartTime
@activityStartTime
end
|
#assetDsc ⇒ Object
Returns the value of attribute assetDsc.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def assetDsc
@assetDsc
end
|
#assetGuid ⇒ Object
Also known as:
id
Returns the value of attribute assetGuid.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def assetGuid
@assetGuid
end
|
#assetName ⇒ Object
Also known as:
title
Returns the value of attribute assetName.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def assetName
@assetName
end
|
#authorName ⇒ Object
Also known as:
author_name
Returns the value of attribute authorName.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def authorName
@authorName
end
|
Returns the value of attribute contactEmailAdr.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def contactEmailAdr
@contactEmailAdr
end
|
Returns the value of attribute contactName.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def contactName
@contactName
end
|
Returns the value of attribute contactPhone.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def contactPhone
@contactPhone
end
|
Returns the value of attribute contactTxt.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def contactTxt
@contactTxt
end
|
#createdDate ⇒ Object
Also known as:
created_at
Returns the value of attribute createdDate.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def createdDate
@createdDate
end
|
#currencyCd ⇒ Object
Also known as:
currency_code
Returns the value of attribute currencyCd.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def currencyCd
@currencyCd
end
|
#homePageUrlAdr ⇒ Object
Also known as:
home_page_url
Returns the value of attribute homePageUrlAdr.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def homePageUrlAdr
@homePageUrlAdr
end
|
#is_article ⇒ Object
Returns the value of attribute is_article.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def is_article
@is_article
end
|
#is_event ⇒ Object
Returns the value of attribute is_event.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def is_event
@is_event
end
|
#isRecurring ⇒ Object
Also known as:
is_recurring?
Returns the value of attribute isRecurring.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def isRecurring
@isRecurring
end
|
#modifiedDate ⇒ Object
Also known as:
updated_at
Returns the value of attribute modifiedDate.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def modifiedDate
@modifiedDate
end
|
#publishDate ⇒ Object
Also known as:
published_at
Returns the value of attribute publishDate.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def publishDate
@publishDate
end
|
#regReqGenderCd ⇒ Object
Also known as:
required_gender
Returns the value of attribute regReqGenderCd.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def regReqGenderCd
@regReqGenderCd
end
|
#regReqMaxAge ⇒ Object
Also known as:
maximum_age
Returns the value of attribute regReqMaxAge.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def regReqMaxAge
@regReqMaxAge
end
|
#regReqMinAge ⇒ Object
Also known as:
minimum_age
Returns the value of attribute regReqMinAge.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def regReqMinAge
@regReqMinAge
end
|
Returns the value of attribute showContact.
18
19
20
|
# File 'lib/actv/asset.rb', line 18
def showContact
@showContact
end
|
Instance Method Details
#activenet? ⇒ Boolean
244
245
246
|
# File 'lib/actv/asset.rb', line 244
def activenet?
self.sourceSystem[:legacyGuid].upcase == "FB27C928-54DB-4ECD-B42F-482FC3C8681F" rescue false
end
|
#attribute_paths ⇒ Object
266
267
268
269
270
|
# File 'lib/actv/asset.rb', line 266
def attribute_paths
attributes.map do |attribute|
[sub_topic_path, urlize(attribute)].join "/"
end
end
|
#attributes ⇒ Object
258
259
260
261
262
263
264
|
# File 'lib/actv/asset.rb', line 258
def attributes
@attributes ||= assetAttributes.sort_by do |attribute|
attribute[:attribute][:attributeType]
end.map do |attribute|
attribute[:attribute][:attributeValue]
end
end
|
#awcamps30? ⇒ Boolean
236
237
238
|
# File 'lib/actv/asset.rb', line 236
def awcamps30?
self.sourceSystem[:legacyGuid].upcase == "89208DBA-F535-4950-880A-34A6888A184C" rescue false
end
|
#awcamps? ⇒ Boolean
232
233
234
|
# File 'lib/actv/asset.rb', line 232
def awcamps?
self.sourceSystem[:legacyGuid].upcase == "2B22B4E6-5AA4-44D7-BF06-F7A71F9FA8A6" rescue false
end
|
#awendurance? ⇒ Boolean
224
225
226
|
# File 'lib/actv/asset.rb', line 224
def awendurance?
self.sourceSystem[:legacyGuid].upcase == "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1" rescue false
end
|
#awsports? ⇒ Boolean
228
229
230
|
# File 'lib/actv/asset.rb', line 228
def awsports?
self.sourceSystem[:legacyGuid].upcase == "F036B0FF-2B21-43A9-8C20-7F447D3AB105" rescue false
end
|
#channels ⇒ Object
Also known as:
asset_channels, assetChannels
100
101
102
103
104
|
# File 'lib/actv/asset.rb', line 100
def channels
@asset_channels ||= Array(@attrs[:assetChannels]).map do |channel|
ACTV::AssetChannel.new(channel)
end
end
|
#components ⇒ Object
Also known as:
asset_components, assetComponents
124
125
126
127
128
|
# File 'lib/actv/asset.rb', line 124
def components
@asset_components ||= Array(@attrs[:assetComponents]).map do |component|
ACTV::AssetComponent.new(component)
end
end
|
#description ⇒ Object
160
161
162
|
# File 'lib/actv/asset.rb', line 160
def description
@description ||= description_by_type 'Standard'
end
|
#description_by_type(type) ⇒ Object
169
170
171
172
|
# File 'lib/actv/asset.rb', line 169
def description_by_type(type)
dsc = self.descriptions.find { |dsc| dsc.type.name.downcase == type.downcase }
(dsc.description.downcase == 'n/a' ? '' : dsc.description) if dsc
end
|
#descriptions ⇒ Object
Also known as:
asset_descriptions, assetDescriptions
76
77
78
79
80
|
# File 'lib/actv/asset.rb', line 76
def descriptions
@descriptions ||= Array(@attrs[:assetDescriptions]).map do |description|
ACTV::AssetDescription.new(description)
end
end
|
#endurance_id ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/actv/asset.rb', line 46
def endurance_id
if self.awendurance?
query_values = Addressable::URI.parse(registrationUrlAdr.to_s).query_values
query_values ||= {}
query_values.fetch 'e', nil
end
end
|
#evergreen? ⇒ Boolean
212
213
214
|
# File 'lib/actv/asset.rb', line 212
def evergreen?
self.evergreenAssetFlag.downcase == 'true' rescue false
end
|
#first_topic ⇒ Object
Also known as:
topic
290
291
292
|
# File 'lib/actv/asset.rb', line 290
def first_topic
get_first_topic_taxonomy[0]
end
|
#first_topic_name ⇒ Object
299
300
301
|
# File 'lib/actv/asset.rb', line 299
def first_topic_name
topics.first.topic.name unless topics.empty?
end
|
#first_topic_path ⇒ Object
295
296
297
|
# File 'lib/actv/asset.rb', line 295
def first_topic_path
urlize first_topic
end
|
#has_location? ⇒ Boolean
208
209
210
|
# File 'lib/actv/asset.rb', line 208
def has_location?
self.place && place.has_lat_long?
end
|
#image ⇒ Object
358
359
360
|
# File 'lib/actv/asset.rb', line 358
def image
image_without_placeholder
end
|
#image_by_name(name) ⇒ Object
174
175
176
|
# File 'lib/actv/asset.rb', line 174
def image_by_name(name)
self.images.find { |img| img.name.downcase == name.downcase }
end
|
#image_path ⇒ Object
343
344
345
346
347
348
349
350
351
352
|
# File 'lib/actv/asset.rb', line 343
def image_path
default_image = 'http://www.active.com/images/events/hotrace.gif'
image = image_without_placeholder.imageUrlAdr rescue ""
if image.empty? and (logoUrlAdr && logoUrlAdr != default_image && !(logoUrlAdr =~ URI::regexp).nil?)
image = logoUrlAdr
end
image
end
|
#image_with_placeholder ⇒ Object
335
336
337
338
339
340
341
|
# File 'lib/actv/asset.rb', line 335
def image_with_placeholder
if image_path.empty?
"/images/logo-active-icon-gray.gif"
else
image_path
end
end
|
#images ⇒ Object
Also known as:
asset_images, assetImages
108
109
110
111
112
|
# File 'lib/actv/asset.rb', line 108
def images
@images ||= Array(@attrs[:assetImages]).map do |img|
ACTV::AssetImage.new(img)
end
end
|
#is_article? ⇒ Boolean
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/actv/asset.rb', line 192
def is_article?
is_article = false
if self.assetCategories.any?
self.assetCategories.each do |category|
if category[:category][:categoryName].downcase == 'articles'
is_article = true
end
end
else
is_article = articles_source?
end
is_article
end
|
#is_event? ⇒ Boolean
183
184
185
186
187
188
189
190
|
# File 'lib/actv/asset.rb', line 183
def is_event?
self.assetCategories.each do |category|
if category[:category][:categoryTaxonomy].downcase.start_with?('event')
return true
end
end
false
end
|
#kids? ⇒ Boolean
248
249
250
251
|
# File 'lib/actv/asset.rb', line 248
def kids?
return false if Rails.env == 'production'
kids_friendly_source_system? && kids_interest?
end
|
#legacy_data ⇒ Object
Also known as:
asset_legacy_data, assetLegacyData
94
95
96
|
# File 'lib/actv/asset.rb', line 94
def legacy_data
@legacy_data ||= ACTV::AssetLegacyData.new(@attrs[:assetLegacyData]) unless @attrs[:assetLegacyData].nil?
end
|
#location_path ⇒ Object
286
287
288
|
# File 'lib/actv/asset.rb', line 286
def location_path
@location ||= "#{place.cityName} #{place.stateProvinceCode}".downcase.gsub ' ','-'
end
|
354
355
356
|
# File 'lib/actv/asset.rb', line 354
def media_url
image_without_placeholder.imageUrlAdr rescue ""
end
|
280
281
282
283
284
|
# File 'lib/actv/asset.rb', line 280
def meta_interest_paths
meta_interests.map do |meta_interest|
[sub_topic_path, urlize(meta_interest)].join "/"
end
end
|
272
273
274
275
276
277
278
|
# File 'lib/actv/asset.rb', line 272
def meta_interests
@meta_interests ||= attrs[:assetMetaInterests].sort_by do |interest|
interest[:sequence]
end.map do |interest|
interest[:metaInterest][:metaInterestName]
end
end
|
#org_timezone ⇒ Object
68
69
70
|
# File 'lib/actv/asset.rb', line 68
def org_timezone
@org_timezone ||= @attrs[:localTimeZoneId] unless @attrs[:localTimeZoneId].nil?
end
|
#place ⇒ Object
60
61
62
|
# File 'lib/actv/asset.rb', line 60
def place
@place ||= ACTV::Place.new(@attrs[:place]) unless @attrs[:place].nil?
end
|
#place_timezone ⇒ Object
64
65
66
|
# File 'lib/actv/asset.rb', line 64
def place_timezone
@place_timezone ||= place[:timezone] unless place[:timezone].nil?
end
|
#prices ⇒ Object
Also known as:
asset_prices, assetPrices
132
133
134
135
136
|
# File 'lib/actv/asset.rb', line 132
def prices
@asset_prices ||= Array(@attrs[:assetPrices]).map do |price|
ACTV::AssetPrice.new(price)
end
end
|
#recurrences ⇒ Object
54
55
56
57
58
|
# File 'lib/actv/asset.rb', line 54
def recurrences
@recurrences ||= Array(@attrs[:activityRecurrences]).map do | recurrence |
ACTV::Recurrence.new(recurrence)
end
end
|
#regcenter2? ⇒ Boolean
220
221
222
|
# File 'lib/actv/asset.rb', line 220
def regcenter2?
self.sourceSystem[:legacyGuid].upcase == "3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6" rescue false
end
|
#regcenter? ⇒ Boolean
216
217
218
|
# File 'lib/actv/asset.rb', line 216
def regcenter?
self.sourceSystem[:legacyGuid].upcase == "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65" rescue false
end
|
#registration_status ⇒ Object
Also known as:
reg_status
253
254
255
|
# File 'lib/actv/asset.rb', line 253
def registration_status
@registration_status ||= nil
end
|
#seo_url(systemName = 'as3') ⇒ Object
164
165
166
167
|
# File 'lib/actv/asset.rb', line 164
def seo_url(systemName = 'as3')
seo_url = self.seo_urls.find { |s| s.seoSystemName.downcase == systemName.downcase }
seo_url.urlAdr unless seo_url.nil?
end
|
#seo_urls ⇒ Object
Also known as:
asset_seo_urls, assetSeoUrls
148
149
150
151
152
|
# File 'lib/actv/asset.rb', line 148
def seo_urls
@seo_urls ||= Array(@attrs[:assetSeoUrls]).map do |seo_url|
ACTV::AssetSeoUrl.new(seo_url)
end
end
|
#status ⇒ Object
Also known as:
asset_status, assetStatus
84
85
86
|
# File 'lib/actv/asset.rb', line 84
def status
@status ||= ACTV::AssetStatus.new(@attrs[:assetStatus]) unless @attrs[:assetStatus].nil?
end
|
#sub_2_topic ⇒ Object
311
312
313
|
# File 'lib/actv/asset.rb', line 311
def sub_2_topic
get_first_topic_taxonomy[2]
end
|
#sub_2_topic_path ⇒ Object
315
316
317
|
# File 'lib/actv/asset.rb', line 315
def sub_2_topic_path
urlize "#{sub_topic_path}/#{sub_2_topic}"
end
|
#sub_3_topic ⇒ Object
319
320
321
|
# File 'lib/actv/asset.rb', line 319
def sub_3_topic
get_first_topic_taxonomy[3]
end
|
#sub_3_topic_path ⇒ Object
323
324
325
|
# File 'lib/actv/asset.rb', line 323
def sub_3_topic_path
urlize "#{sub_2_topic_path}/#{sub_3_topic}"
end
|
#sub_4_topic ⇒ Object
327
328
329
|
# File 'lib/actv/asset.rb', line 327
def sub_4_topic
get_first_topic_taxonomy[4]
end
|
#sub_4_topic_path ⇒ Object
331
332
333
|
# File 'lib/actv/asset.rb', line 331
def sub_4_topic_path
urlize "#{sub_3_topic_path}/#{sub_4_topic}"
end
|
#sub_topic ⇒ Object
303
304
305
|
# File 'lib/actv/asset.rb', line 303
def sub_topic
get_first_topic_taxonomy[1]
end
|
#sub_topic_path ⇒ Object
307
308
309
|
# File 'lib/actv/asset.rb', line 307
def sub_topic_path
urlize sub_topic
end
|
#summary ⇒ Object
156
157
158
|
# File 'lib/actv/asset.rb', line 156
def summary
@summary ||= description_by_type 'summary'
end
|
#tag_by_description(description) ⇒ Object
178
179
180
181
|
# File 'lib/actv/asset.rb', line 178
def tag_by_description(description)
asset_tag = self.tags.find { |at| at.tag.description.downcase == description.downcase }
asset_tag.tag.name if asset_tag
end
|
116
117
118
119
120
|
# File 'lib/actv/asset.rb', line 116
def tags
@asset_tags ||= Array(@attrs[:assetTags]).map do |tag|
ACTV::AssetTag.new(tag)
end
end
|
#thriva? ⇒ Boolean
240
241
242
|
# File 'lib/actv/asset.rb', line 240
def thriva?
self.sourceSystem[:legacyGuid].upcase == "2BA50ABA-080E-4E3D-A01C-1B4F56648A2E" rescue false
end
|
#topics ⇒ Object
Also known as:
asset_topics, assetTopics
140
141
142
143
144
|
# File 'lib/actv/asset.rb', line 140
def topics
@asset_topics ||= Array(@attrs[:assetTopics]).map do |topic|
ACTV::AssetTopic.new(topic)
end.sort
end
|
#version ⇒ Object
72
73
74
|
# File 'lib/actv/asset.rb', line 72
def version
@asset_version ||= @attrs[:assetVersion] unless @attrs[:assetVersion].nil?
end
|
#visible? ⇒ Boolean
90
91
92
|
# File 'lib/actv/asset.rb', line 90
def visible?
asset_status.visible?
end
|