Class: Active::Services::Activity
- Inherits:
-
Object
- Object
- Active::Services::Activity
- Defined in:
- lib/services/activity.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#category ⇒ Object
Returns the value of attribute category.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(data) ⇒ Activity
constructor
A new instance of Activity.
Constructor Details
#initialize(data) ⇒ Activity
Returns a new instance of Activity.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/services/activity.rb', line 5 def initialize data data = HashWithIndifferentAccess.new(data) @title = data[:title] unless data[:meta].nil? @start_date = Date.parse(data[:meta][:startDate]) @end_date = Date.parse(data[:meta][:endDate]) if data[:meta][:endDate] @category = data[:meta][:channel] ||= "" @desc = data[:meta][:description] ||= "" @start_time = data[:meta][:startTime] ||= "" @end_time = data[:meta][:endTime] ||= "" @address = { :name => data[:meta][:location], # # :address => data[:meta][''], || "" , :city => data[:meta][:city], :state => data[:meta][:state], :zip => data[:meta][:zip], :lat => data[:meta][:latitude], :lng => data[:meta][:longitude], :country => data[:meta][:country] } end @onlineDonationAvailable = data[:meta][:onlineDonationAvailable] @onlineRegistrationAvailable = data[:meta][:onlineRegistrationAvailable] @onlineMembershipAvailable = data[:meta][:onlineMembershipAvailable] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def address @address end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def category @category end |
#desc ⇒ Object
Returns the value of attribute desc.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def desc @desc end |
#end_date ⇒ Object
Returns the value of attribute end_date.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def end_date @end_date end |
#end_time ⇒ Object
Returns the value of attribute end_time.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def end_time @end_time end |
#start_date ⇒ Object
Returns the value of attribute start_date.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def start_date @start_date end |
#start_time ⇒ Object
Returns the value of attribute start_time.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def start_time @start_time end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def title @title end |