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.
-
#asset_id ⇒ Object
Returns the value of attribute asset_id.
-
#asset_type_id ⇒ Object
Returns the value of attribute asset_type_id.
-
#category ⇒ Object
Returns the value of attribute category.
-
#data ⇒ Object
Returns the value of attribute data.
-
#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.
-
#endIndex ⇒ Object
Returns the value of attribute endIndex.
-
#numberOfResults ⇒ Object
Returns the value of attribute numberOfResults.
-
#pageSize ⇒ Object
Returns the value of attribute pageSize.
-
#searchTime ⇒ Object
Returns the value of attribute searchTime.
-
#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.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(data) ⇒ Activity
constructor
A new instance of Activity.
Constructor Details
#initialize(data) ⇒ Activity
Returns a new instance of Activity.
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 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/services/activity.rb', line 6 def initialize data @data = HashWithIndifferentAccess.new(data) self.title = @data[:title] @url = @data[:url] @pageSize = @data[:pageSize] @searchTime = @data[:searchTime] @numberOfResults = @data[:numberOfResults] unless @data[:meta].nil? self.asset_id = @data[:meta][:assetId] self.asset_type_id = @data[:meta][:assetTypeId] @start_date = Date.parse(@data[:meta][:startDate]) @end_date = Date.parse(@data[:meta][:endDate]) if @data[:meta][:endDate] self.category = @data[:meta][:channel] ||= "" @desc = @data[:meta][:description] ||= "" @start_time = @data[:meta][:startTime] ||= "" @end_time = @data[:meta][:endTime] ||= "" @address = { :name => @data[:meta][:locationName], :address => @data[:meta][:location], :city => @data[:meta][:city], :state => @data[:meta][:state], :zip => @data[:meta][:zip], :lat => @data[:meta][:latitude], :lng => @data[:meta][:longitude], :country => @data[:meta][:country] # dma? } 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 |
#asset_id ⇒ Object
Returns the value of attribute asset_id.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def asset_id @asset_id end |
#asset_type_id ⇒ Object
Returns the value of attribute asset_type_id.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def asset_type_id @asset_type_id end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def category @category end |
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def data @data 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 |
#endIndex ⇒ Object
Returns the value of attribute endIndex.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def endIndex @endIndex end |
#numberOfResults ⇒ Object
Returns the value of attribute numberOfResults.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def numberOfResults @numberOfResults end |
#pageSize ⇒ Object
Returns the value of attribute pageSize.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def pageSize @pageSize end |
#searchTime ⇒ Object
Returns the value of attribute searchTime.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def searchTime @searchTime 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 |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/services/activity.rb', line 4 def url @url end |