Class: Active::Services::Activity

Inherits:
Object
  • Object
show all
Defined in:
lib/services/activity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#addressObject

Returns the value of attribute address.



4
5
6
# File 'lib/services/activity.rb', line 4

def address
  @address
end

#categoryObject

Returns the value of attribute category.



4
5
6
# File 'lib/services/activity.rb', line 4

def category
  @category
end

#descObject

Returns the value of attribute desc.



4
5
6
# File 'lib/services/activity.rb', line 4

def desc
  @desc
end

#end_dateObject

Returns the value of attribute end_date.



4
5
6
# File 'lib/services/activity.rb', line 4

def end_date
  @end_date
end

#end_timeObject

Returns the value of attribute end_time.



4
5
6
# File 'lib/services/activity.rb', line 4

def end_time
  @end_time
end

#start_dateObject

Returns the value of attribute start_date.



4
5
6
# File 'lib/services/activity.rb', line 4

def start_date
  @start_date
end

#start_timeObject

Returns the value of attribute start_time.



4
5
6
# File 'lib/services/activity.rb', line 4

def start_time
  @start_time
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/services/activity.rb', line 4

def title
  @title
end