Class: ACTV::Asset
Instance Attribute Summary collapse
Attributes inherited from Base
#attrs
Class Method Summary
collapse
Instance Method Summary
collapse
-
#acm? ⇒ Boolean
-
#activenet? ⇒ Boolean
-
#attribute_paths ⇒ Object
-
#attributes ⇒ Object
-
#awcamps30? ⇒ Boolean
-
#awcamps? ⇒ Boolean
-
#awendurance? ⇒ Boolean
-
#awsports? ⇒ Boolean
-
#category_is?(name) ⇒ 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
-
#leagueone? ⇒ 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
-
#organization ⇒ Object
-
#place ⇒ Object
-
#place_timezone ⇒ Object
-
#prices ⇒ Object
(also: #asset_prices, #assetPrices)
-
#recurrences ⇒ Object
-
#references ⇒ Object
-
#regcenter2? ⇒ Boolean
-
#regcenter? ⇒ Boolean
-
#registration_status ⇒ Object
(also: #reg_status)
-
#researched? ⇒ Boolean
-
#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)
-
#tennislinkteam? ⇒ Boolean
-
#tennislinktournament? ⇒ Boolean
-
#tennislinkusta? ⇒ Boolean
-
#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, #delete, #initialize, #memoize, #method_missing, object_attr_reader, #respond_to?, #to_hash, #update, 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.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def activityEndDate
@activityEndDate
end
|
#activityEndTime ⇒ Object
Also known as:
end_time
Returns the value of attribute activityEndTime.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def activityEndTime
@activityEndTime
end
|
#activityStartDate ⇒ Object
Also known as:
start_date, activity_start_date
Returns the value of attribute activityStartDate.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def activityStartDate
@activityStartDate
end
|
#activityStartTime ⇒ Object
Also known as:
start_time
Returns the value of attribute activityStartTime.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def activityStartTime
@activityStartTime
end
|
#assetDsc ⇒ Object
Returns the value of attribute assetDsc.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def assetDsc
@assetDsc
end
|
#assetGuid ⇒ Object
Also known as:
id
Returns the value of attribute assetGuid.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def assetGuid
@assetGuid
end
|
#assetName ⇒ Object
Also known as:
title
Returns the value of attribute assetName.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def assetName
@assetName
end
|
#authorName ⇒ Object
Also known as:
author_name
Returns the value of attribute authorName.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def authorName
@authorName
end
|
Returns the value of attribute contactEmailAdr.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def contactEmailAdr
@contactEmailAdr
end
|
Returns the value of attribute contactName.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def contactName
@contactName
end
|
Returns the value of attribute contactPhone.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def contactPhone
@contactPhone
end
|
Returns the value of attribute contactTxt.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def contactTxt
@contactTxt
end
|
#createdDate ⇒ Object
Also known as:
created_at
Returns the value of attribute createdDate.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def createdDate
@createdDate
end
|
#currencyCd ⇒ Object
Also known as:
currency_code
Returns the value of attribute currencyCd.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def currencyCd
@currencyCd
end
|
#homePageUrlAdr ⇒ Object
Also known as:
home_page_url
Returns the value of attribute homePageUrlAdr.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def homePageUrlAdr
@homePageUrlAdr
end
|
#is_article ⇒ Object
Returns the value of attribute is_article.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def is_article
@is_article
end
|
#is_event ⇒ Object
Returns the value of attribute is_event.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def is_event
@is_event
end
|
#isRecurring ⇒ Object
Also known as:
is_recurring?
Returns the value of attribute isRecurring.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def isRecurring
@isRecurring
end
|
#modifiedDate ⇒ Object
Also known as:
updated_at
Returns the value of attribute modifiedDate.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def modifiedDate
@modifiedDate
end
|
#publishDate ⇒ Object
Also known as:
published_at
Returns the value of attribute publishDate.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def publishDate
@publishDate
end
|
#regReqGenderCd ⇒ Object
Also known as:
required_gender
Returns the value of attribute regReqGenderCd.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def regReqGenderCd
@regReqGenderCd
end
|
#regReqMaxAge ⇒ Object
Also known as:
maximum_age
Returns the value of attribute regReqMaxAge.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def regReqMaxAge
@regReqMaxAge
end
|
#regReqMinAge ⇒ Object
Also known as:
minimum_age
Returns the value of attribute regReqMinAge.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def regReqMinAge
@regReqMinAge
end
|
Returns the value of attribute showContact.
20
21
22
|
# File 'lib/actv/asset.rb', line 20
def showContact
@showContact
end
|
Class Method Details
.from_response(response = {}) ⇒ Object
56
57
58
|
# File 'lib/actv/asset.rb', line 56
def self.from_response response={}
AssetFactory.new(response[:body]).asset
end
|
.inherited(base) ⇒ Object
48
49
50
|
# File 'lib/actv/asset.rb', line 48
def self.inherited base
@types << base
end
|
.types ⇒ Object
52
53
54
|
# File 'lib/actv/asset.rb', line 52
def self.types
@types + Array(self)
end
|
.valid?(response) ⇒ Boolean
60
61
62
|
# File 'lib/actv/asset.rb', line 60
def self.valid? response
AssetValidator.new(response).valid?
end
|
Instance Method Details
#acm? ⇒ Boolean
253
254
255
|
# File 'lib/actv/asset.rb', line 253
def acm?
self.sourceSystem[:legacyGuid].upcase == "CA4EA0B1-7377-470D-B20D-BF6BEA23F040" rescue false
end
|
#activenet? ⇒ Boolean
245
246
247
|
# File 'lib/actv/asset.rb', line 245
def activenet?
self.sourceSystem[:legacyGuid].upcase == "FB27C928-54DB-4ECD-B42F-482FC3C8681F" rescue false
end
|
#attribute_paths ⇒ Object
290
291
292
293
294
|
# File 'lib/actv/asset.rb', line 290
def attribute_paths
attributes.map do |attribute|
[sub_topic_path, urlize(attribute)].join "/"
end
end
|
#attributes ⇒ Object
282
283
284
285
286
287
288
|
# File 'lib/actv/asset.rb', line 282
def attributes
@attributes ||= assetAttributes.sort_by do |attribute|
attribute[:attribute][:attributeType]
end.map do |attribute|
attribute[:attribute][:attributeValue]
end
end
|
#awcamps30? ⇒ Boolean
237
238
239
|
# File 'lib/actv/asset.rb', line 237
def awcamps30?
self.sourceSystem[:legacyGuid].upcase == "89208DBA-F535-4950-880A-34A6888A184C" rescue false
end
|
#awcamps? ⇒ Boolean
233
234
235
|
# File 'lib/actv/asset.rb', line 233
def awcamps?
self.sourceSystem[:legacyGuid].upcase == "2B22B4E6-5AA4-44D7-BF06-F7A71F9FA8A6" rescue false
end
|
#awendurance? ⇒ Boolean
225
226
227
|
# File 'lib/actv/asset.rb', line 225
def awendurance?
self.sourceSystem[:legacyGuid].upcase == "DFAA997A-D591-44CA-9FB7-BF4A4C8984F1" rescue false
end
|
#awsports? ⇒ Boolean
229
230
231
|
# File 'lib/actv/asset.rb', line 229
def awsports?
self.sourceSystem[:legacyGuid].upcase == "F036B0FF-2B21-43A9-8C20-7F447D3AB105" rescue false
end
|
#category_is?(name) ⇒ Boolean
392
393
394
395
396
|
# File 'lib/actv/asset.rb', line 392
def category_is? name
@attrs[:assetCategories].any? do |cat|
cat[:category][:categoryName].downcase == name.downcase
end
end
|
#channels ⇒ Object
Also known as:
asset_channels, assetChannels
118
119
120
121
122
|
# File 'lib/actv/asset.rb', line 118
def channels
@asset_channels ||= Array(@attrs[:assetChannels]).map do |channel|
ACTV::AssetChannel.new(channel)
end
end
|
#components ⇒ Object
Also known as:
asset_components, assetComponents
142
143
144
145
146
|
# File 'lib/actv/asset.rb', line 142
def components
@asset_components ||= Array(@attrs[:assetComponents]).map do |component|
ACTV::AssetComponent.new(component)
end
end
|
#description ⇒ Object
178
179
180
|
# File 'lib/actv/asset.rb', line 178
def description
@description ||= description_by_type 'Standard'
end
|
#description_by_type(type) ⇒ Object
187
188
189
190
|
# File 'lib/actv/asset.rb', line 187
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
94
95
96
97
98
|
# File 'lib/actv/asset.rb', line 94
def descriptions
@descriptions ||= Array(@attrs[:assetDescriptions]).map do |description|
ACTV::AssetDescription.new(description)
end
end
|
#endurance_id ⇒ Object
64
65
66
67
68
69
70
|
# File 'lib/actv/asset.rb', line 64
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
213
214
215
|
# File 'lib/actv/asset.rb', line 213
def evergreen?
self.evergreenAssetFlag.downcase == 'true' rescue false
end
|
#first_topic ⇒ Object
Also known as:
topic
314
315
316
|
# File 'lib/actv/asset.rb', line 314
def first_topic
get_first_topic_taxonomy[0]
end
|
#first_topic_name ⇒ Object
323
324
325
|
# File 'lib/actv/asset.rb', line 323
def first_topic_name
topics.first.topic.name unless topics.empty?
end
|
#first_topic_path ⇒ Object
319
320
321
|
# File 'lib/actv/asset.rb', line 319
def first_topic_path
urlize first_topic
end
|
#has_location? ⇒ Boolean
209
210
211
|
# File 'lib/actv/asset.rb', line 209
def has_location?
self.place && place.has_lat_long?
end
|
#image ⇒ Object
382
383
384
|
# File 'lib/actv/asset.rb', line 382
def image
image_without_placeholder
end
|
#image_by_name(name) ⇒ Object
192
193
194
|
# File 'lib/actv/asset.rb', line 192
def image_by_name(name)
self.images.find { |img| img.name.downcase == name.downcase }
end
|
#image_path ⇒ Object
367
368
369
370
371
372
373
374
375
376
|
# File 'lib/actv/asset.rb', line 367
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
359
360
361
362
363
364
365
|
# File 'lib/actv/asset.rb', line 359
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
126
127
128
129
130
|
# File 'lib/actv/asset.rb', line 126
def images
@images ||= Array(@attrs[:assetImages]).map do |img|
ACTV::AssetImage.new(img)
end
end
|
#is_article? ⇒ Boolean
205
206
207
|
# File 'lib/actv/asset.rb', line 205
def is_article?
false
end
|
#is_event? ⇒ Boolean
201
202
203
|
# File 'lib/actv/asset.rb', line 201
def is_event?
false
end
|
#kids? ⇒ Boolean
273
274
275
|
# File 'lib/actv/asset.rb', line 273
def kids?
kids_friendly_source_system? && kids_interest?
end
|
#leagueone? ⇒ Boolean
257
258
259
|
# File 'lib/actv/asset.rb', line 257
def leagueone?
self.sourceSystem[:legacyGuid].upcase == "74742258-90FE-40ED-8A60-89F21DE93BFD" rescue false
end
|
#legacy_data ⇒ Object
Also known as:
asset_legacy_data, assetLegacyData
112
113
114
|
# File 'lib/actv/asset.rb', line 112
def legacy_data
@legacy_data ||= ACTV::AssetLegacyData.new(@attrs[:assetLegacyData]) unless @attrs[:assetLegacyData].nil?
end
|
#location_path ⇒ Object
310
311
312
|
# File 'lib/actv/asset.rb', line 310
def location_path
@location ||= "#{place.cityName} #{place.stateProvinceCode}".downcase.gsub ' ','-'
end
|
378
379
380
|
# File 'lib/actv/asset.rb', line 378
def media_url
image_without_placeholder.imageUrlAdr rescue ""
end
|
304
305
306
307
308
|
# File 'lib/actv/asset.rb', line 304
def meta_interest_paths
meta_interests.map do |meta_interest|
[sub_topic_path, urlize(meta_interest)].join "/"
end
end
|
296
297
298
299
300
301
302
|
# File 'lib/actv/asset.rb', line 296
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
86
87
88
|
# File 'lib/actv/asset.rb', line 86
def org_timezone
@org_timezone ||= @attrs[:localTimeZoneId] unless @attrs[:localTimeZoneId].nil?
end
|
#organization ⇒ Object
398
399
400
|
# File 'lib/actv/asset.rb', line 398
def organization
@attrs[:organization] || {}
end
|
#place ⇒ Object
78
79
80
|
# File 'lib/actv/asset.rb', line 78
def place
@place ||= ACTV::Place.new(@attrs[:place]) unless @attrs[:place].nil?
end
|
#place_timezone ⇒ Object
82
83
84
|
# File 'lib/actv/asset.rb', line 82
def place_timezone
@place_timezone ||= place[:timezone] unless place[:timezone].nil?
end
|
#prices ⇒ Object
Also known as:
asset_prices, assetPrices
150
151
152
153
154
|
# File 'lib/actv/asset.rb', line 150
def prices
@asset_prices ||= Array(@attrs[:assetPrices]).map do |price|
ACTV::AssetPrice.new(price)
end
end
|
#recurrences ⇒ Object
72
73
74
75
76
|
# File 'lib/actv/asset.rb', line 72
def recurrences
@recurrences ||= Array(@attrs[:activityRecurrences]).map do | recurrence |
ACTV::Recurrence.new(recurrence)
end
end
|
#references ⇒ Object
386
387
388
389
390
|
# File 'lib/actv/asset.rb', line 386
def references
@references ||= Array(@attrs[:assetReferences]).map do |reference|
ACTV::AssetReference.new reference
end
end
|
#regcenter2? ⇒ Boolean
221
222
223
|
# File 'lib/actv/asset.rb', line 221
def regcenter2?
self.sourceSystem[:legacyGuid].upcase == "3BF82BBE-CF88-4E8C-A56F-78F5CE87E4C6" rescue false
end
|
#regcenter? ⇒ Boolean
217
218
219
|
# File 'lib/actv/asset.rb', line 217
def regcenter?
self.sourceSystem[:legacyGuid].upcase == "EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65" rescue false
end
|
#registration_status ⇒ Object
Also known as:
reg_status
277
278
279
|
# File 'lib/actv/asset.rb', line 277
def registration_status
@registration_status ||= nil
end
|
#researched? ⇒ Boolean
249
250
251
|
# File 'lib/actv/asset.rb', line 249
def researched?
self.sourceSystem[:legacyGuid].upcase == "B47B0828-23ED-4D85-BDF0-B22819F53332" rescue false
end
|
#seo_url(systemName = 'as3') ⇒ Object
182
183
184
185
|
# File 'lib/actv/asset.rb', line 182
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
166
167
168
169
170
|
# File 'lib/actv/asset.rb', line 166
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
102
103
104
|
# File 'lib/actv/asset.rb', line 102
def status
@status ||= ACTV::AssetStatus.new(@attrs[:assetStatus]) unless @attrs[:assetStatus].nil?
end
|
#sub_2_topic ⇒ Object
335
336
337
|
# File 'lib/actv/asset.rb', line 335
def sub_2_topic
get_first_topic_taxonomy[2]
end
|
#sub_2_topic_path ⇒ Object
339
340
341
|
# File 'lib/actv/asset.rb', line 339
def sub_2_topic_path
urlize "#{sub_topic_path}/#{sub_2_topic}"
end
|
#sub_3_topic ⇒ Object
343
344
345
|
# File 'lib/actv/asset.rb', line 343
def sub_3_topic
get_first_topic_taxonomy[3]
end
|
#sub_3_topic_path ⇒ Object
347
348
349
|
# File 'lib/actv/asset.rb', line 347
def sub_3_topic_path
urlize "#{sub_2_topic_path}/#{sub_3_topic}"
end
|
#sub_4_topic ⇒ Object
351
352
353
|
# File 'lib/actv/asset.rb', line 351
def sub_4_topic
get_first_topic_taxonomy[4]
end
|
#sub_4_topic_path ⇒ Object
355
356
357
|
# File 'lib/actv/asset.rb', line 355
def sub_4_topic_path
urlize "#{sub_3_topic_path}/#{sub_4_topic}"
end
|
#sub_topic ⇒ Object
327
328
329
|
# File 'lib/actv/asset.rb', line 327
def sub_topic
get_first_topic_taxonomy[1]
end
|
#sub_topic_path ⇒ Object
331
332
333
|
# File 'lib/actv/asset.rb', line 331
def sub_topic_path
urlize sub_topic
end
|
#summary ⇒ Object
174
175
176
|
# File 'lib/actv/asset.rb', line 174
def summary
@summary ||= description_by_type 'summary'
end
|
#tag_by_description(description) ⇒ Object
196
197
198
199
|
# File 'lib/actv/asset.rb', line 196
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
|
134
135
136
137
138
|
# File 'lib/actv/asset.rb', line 134
def tags
@asset_tags ||= Array(@attrs[:assetTags]).map do |tag|
ACTV::AssetTag.new(tag)
end
end
|
#tennislinkteam? ⇒ Boolean
261
262
263
|
# File 'lib/actv/asset.rb', line 261
def tennislinkteam?
self.sourceSystem[:legacyGuid].upcase == "0206DC72-C167-4B39-B299-0F2A27D8CBEF" rescue false
end
|
#tennislinktournament? ⇒ Boolean
265
266
267
|
# File 'lib/actv/asset.rb', line 265
def tennislinktournament?
self.sourceSystem[:legacyGuid].upcase == "71D917DE-FA90-448A-90DA-C8852F7E03E2" rescue false
end
|
#tennislinkusta? ⇒ Boolean
269
270
271
|
# File 'lib/actv/asset.rb', line 269
def tennislinkusta?
self.sourceSystem[:legacyGuid].upcase == "3858B6E3-B52E-4E20-9A00-2AD8500B1BC3" rescue false
end
|
#thriva? ⇒ Boolean
241
242
243
|
# File 'lib/actv/asset.rb', line 241
def thriva?
self.sourceSystem[:legacyGuid].upcase == "2BA50ABA-080E-4E3D-A01C-1B4F56648A2E" rescue false
end
|
#topics ⇒ Object
Also known as:
asset_topics, assetTopics
158
159
160
161
162
|
# File 'lib/actv/asset.rb', line 158
def topics
@asset_topics ||= Array(@attrs[:assetTopics]).map do |topic|
ACTV::AssetTopic.new(topic)
end.sort
end
|
#version ⇒ Object
90
91
92
|
# File 'lib/actv/asset.rb', line 90
def version
@asset_version ||= @attrs[:assetVersion] unless @attrs[:assetVersion].nil?
end
|
#visible? ⇒ Boolean
108
109
110
|
# File 'lib/actv/asset.rb', line 108
def visible?
asset_status.visible?
end
|