Class: ACTV::Event
Instance Attribute Summary collapse
-
#activityEndDate ⇒ Object
readonly
Returns the value of attribute activityEndDate.
-
#activityStartDate ⇒ Object
readonly
Returns the value of attribute activityStartDate.
-
#salesEndDate ⇒ Object
(also: #sales_end_date)
readonly
Returns the value of attribute salesEndDate.
-
#salesStartDate ⇒ Object
(also: #sales_start_date)
readonly
Returns the value of attribute salesStartDate.
Attributes inherited from Asset
#activityEndTime, #activityStartTime, #assetDsc, #assetGuid, #assetName, #authorName, #contactEmailAdr, #contactName, #contactPhone, #contactTxt, #createdDate, #currencyCd, #homePageUrlAdr, #isRecurring, #is_article, #is_event, #modifiedDate, #publishDate, #regReqGenderCd, #regReqMaxAge, #regReqMinAge, #showContact
Attributes inherited from Base
Instance Method Summary collapse
- #display_close_date ⇒ Object (also: #display_close_date?)
-
#event_end_date ⇒ Object
Returns the asset’s end date in UTC.
- #event_ended? ⇒ Boolean (also: #ended?)
-
#event_start_date ⇒ Object
Returns the asset’s start date in UTC.
- #image_url ⇒ Object
- #online_registration_available? ⇒ Boolean (also: #online_registration?)
-
#registration_close_date ⇒ Object
Returns the asset’s registration end date in UTC.
- #registration_closed? ⇒ Boolean (also: #reg_closed?)
- #registration_closing_soon?(time_in_days = 3) ⇒ Boolean
- #registration_not_yet_open? ⇒ Boolean (also: #registration_not_open?, #reg_not_open?, #reg_not_yet_open?)
- #registration_open? ⇒ Boolean (also: #reg_open?)
-
#registration_open_date ⇒ Object
Returns the asset’s registration open date in UTC.
- #registration_opening_soon?(time_in_days = 3) ⇒ Boolean
- #timezone_offset ⇒ Object
Methods inherited from Asset
#activenet?, #attribute_paths, #attributes, #awcamps30?, #awcamps?, #awendurance?, #awsports?, #channels, #components, #description, #description_by_type, #descriptions, #endurance_id, #evergreen?, #first_topic, #first_topic_name, #first_topic_path, #has_location?, #image, #image_by_name, #image_path, #image_with_placeholder, #images, #is_article?, #is_event?, #kids?, #legacy_data, #location_path, #media_url, #meta_interest_paths, #meta_interests, #org_timezone, #place, #place_timezone, #prices, #recurrences, #regcenter2?, #regcenter?, #registration_status, #seo_url, #seo_urls, #status, #sub_2_topic, #sub_2_topic_path, #sub_3_topic, #sub_3_topic_path, #sub_4_topic, #sub_4_topic_path, #sub_topic, #sub_topic_path, #summary, #tag_by_description, #tags, #thriva?, #topics, #version, #visible?
Methods inherited from Identity
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 (readonly)
Returns the value of attribute activityEndDate.
5 6 7 |
# File 'lib/actv/event.rb', line 5 def activityEndDate @activityEndDate end |
#activityStartDate ⇒ Object (readonly)
Returns the value of attribute activityStartDate.
5 6 7 |
# File 'lib/actv/event.rb', line 5 def activityStartDate @activityStartDate end |
#salesEndDate ⇒ Object (readonly) Also known as: sales_end_date
Returns the value of attribute salesEndDate.
5 6 7 |
# File 'lib/actv/event.rb', line 5 def salesEndDate @salesEndDate end |
#salesStartDate ⇒ Object (readonly) Also known as: sales_start_date
Returns the value of attribute salesStartDate.
5 6 7 |
# File 'lib/actv/event.rb', line 5 def salesStartDate @salesStartDate end |
Instance Method Details
#display_close_date ⇒ Object Also known as: display_close_date?
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/actv/event.rb', line 81 def display_close_date @display_close_date ||= begin val = tag_by_description 'displayclosedate' if val val.downcase == 'true' else true end end end |
#event_end_date ⇒ Object
Returns the asset’s end date in UTC. This is pulled from the activityEndDate.
115 116 117 |
# File 'lib/actv/event.rb', line 115 def event_end_date Time.parse "#{activity_end_date} #{format_timezone_offset(timezone_offset)}" end |
#event_ended? ⇒ Boolean Also known as: ended?
45 46 47 48 49 |
# File 'lib/actv/event.rb', line 45 def event_ended? if is_present? activity_end_date is_now_after? "#{activity_end_date.split('T').first}T23:59:59" end end |
#event_start_date ⇒ Object
Returns the asset’s start date in UTC. This is pulled from the activityStartDate.
109 110 111 |
# File 'lib/actv/event.rb', line 109 def event_start_date Time.parse "#{activity_start_date} #{format_timezone_offset(timezone_offset)}" end |
#image_url ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/actv/event.rb', line 125 def image_url defaultImage = 'http://www.active.com/images/events/hotrace.gif' image = '' self.assetImages.each do |i| if i.imageUrlAdr.downcase != defaultImage image = i.imageUrlAdr break end end if image.blank? if (self.logoUrlAdr && self.logoUrlAdr != defaultImage && self.logoUrlAdr =~ URI::regexp) image = self.logoUrlAdr end end image end |
#online_registration_available? ⇒ Boolean Also known as: online_registration?
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/actv/event.rb', line 9 def online_registration_available? if is_present?(self.registrationUrlAdr) if is_present?(self.legacy_data) && is_present?(self.legacy_data.onlineRegistration) self.legacy_data.onlineRegistration.downcase == 'true' else true end else false end end |
#registration_close_date ⇒ Object
Returns the asset’s registration end date in UTC. This is pulled from the salesEndDate
103 104 105 |
# File 'lib/actv/event.rb', line 103 def registration_close_date Time.parse "#{} UTC" end |
#registration_closed? ⇒ Boolean Also known as: reg_closed?
29 30 31 32 33 34 35 |
# File 'lib/actv/event.rb', line 29 def registration_closed? if online_registration_available? is_now_after? else false end end |
#registration_closing_soon?(time_in_days = 3) ⇒ Boolean
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/actv/event.rb', line 66 def registration_closing_soon?(time_in_days=3) @reg_closing_soon ||= begin if online_registration_available? if self.sales_end_date if now_in_utc >= utc_time(self.sales_end_date) - time_in_days.days and now_in_utc < utc_time(self.end_date) return true end end end false end end |
#registration_not_yet_open? ⇒ Boolean Also known as: registration_not_open?, reg_not_open?, reg_not_yet_open?
37 38 39 40 41 42 43 |
# File 'lib/actv/event.rb', line 37 def registration_not_yet_open? if online_registration_available? is_now_before? else false end end |
#registration_open? ⇒ Boolean Also known as: reg_open?
21 22 23 24 25 26 27 |
# File 'lib/actv/event.rb', line 21 def registration_open? if online_registration_available? is_now_between? , else false end end |
#registration_open_date ⇒ Object
Returns the asset’s registration open date in UTC. This is pulled from the salesStartDate
97 98 99 |
# File 'lib/actv/event.rb', line 97 def registration_open_date Time.parse "#{} UTC" end |
#registration_opening_soon?(time_in_days = 3) ⇒ Boolean
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/actv/event.rb', line 51 def registration_opening_soon?(time_in_days=3) @reg_open_soon ||= begin if online_registration_available? if self.sales_start_date if now_in_utc >= utc_time(self.sales_start_date) - time_in_days.days and now_in_utc < utc_time(self.sales_start_date) return true end end end false end end |
#timezone_offset ⇒ Object
119 120 121 |
# File 'lib/actv/event.rb', line 119 def timezone_offset place.timezoneOffset + place.timezoneDST end |