Class: ACTV::Event
Instance Attribute Summary collapse
-
#activityEndDate ⇒ Object
(also: #activity_end_date)
readonly
Returns the value of attribute activityEndDate.
-
#activityStartDate ⇒ Object
(also: #activity_start_date)
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, #createdDate, #homePageUrlAdr, #isRecurring, #is_article, #is_event, #modifiedDate, #publishDate, #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
#channels, #components, #description, #description_by_type, #descriptions, #evergreen?, #image_by_name, #images, #is_article?, #is_event?, #legacy_data, #place, #place_timezone, #prices, #registration_status, #seo_url, #seo_urls, #status, #summary, #tag_by_description, #tags, #topics
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) Also known as: activity_end_date
Returns the value of attribute activityEndDate.
5 6 7 |
# File 'lib/actv/event.rb', line 5 def activityEndDate @activityEndDate end |
#activityStartDate ⇒ Object (readonly) Also known as: activity_start_date
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?
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/actv/event.rb', line 83 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.
117 118 119 |
# File 'lib/actv/event.rb', line 117 def event_end_date Time.parse "#{activity_end_date} #{format_timezone_offset(timezone_offset)}" end |
#event_ended? ⇒ Boolean Also known as: ended?
47 48 49 50 51 |
# File 'lib/actv/event.rb', line 47 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.
111 112 113 |
# File 'lib/actv/event.rb', line 111 def event_start_date Time.parse "#{activity_start_date} #{format_timezone_offset(timezone_offset)}" end |
#image_url ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/actv/event.rb', line 127 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?
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/actv/event.rb', line 11 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
105 106 107 |
# File 'lib/actv/event.rb', line 105 def registration_close_date Time.parse "#{} UTC" end |
#registration_closed? ⇒ Boolean Also known as: reg_closed?
31 32 33 34 35 36 37 |
# File 'lib/actv/event.rb', line 31 def registration_closed? if online_registration_available? is_now_after? else false end end |
#registration_closing_soon?(time_in_days = 3) ⇒ Boolean
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/actv/event.rb', line 68 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?
39 40 41 42 43 44 45 |
# File 'lib/actv/event.rb', line 39 def registration_not_yet_open? if online_registration_available? is_now_before? else false end end |
#registration_open? ⇒ Boolean Also known as: reg_open?
23 24 25 26 27 28 29 |
# File 'lib/actv/event.rb', line 23 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
99 100 101 |
# File 'lib/actv/event.rb', line 99 def registration_open_date Time.parse "#{} UTC" end |
#registration_opening_soon?(time_in_days = 3) ⇒ Boolean
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/actv/event.rb', line 53 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
121 122 123 |
# File 'lib/actv/event.rb', line 121 def timezone_offset place.timezoneOffset + place.timezoneDST end |