Class: ConstantContact::Components::Activity

Inherits:
Component
  • Object
show all
Defined in:
lib/constantcontact/components/activities/activity.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Component

#to_hash, to_hash_value, #to_json

Instance Attribute Details

#contact_countObject

Returns the value of attribute contact_count



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def contact_count
  @contact_count
end

#created_dateObject

Returns the value of attribute created_date



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def created_date
  @created_date
end

#error_countObject

Returns the value of attribute error_count



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def error_count
  @error_count
end

#errorsObject

Returns the value of attribute errors



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def errors
  @errors
end

#file_nameObject

Returns the value of attribute file_name



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def file_name
  @file_name
end

#finish_dateObject

Returns the value of attribute finish_date



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def finish_date
  @finish_date
end

#idObject

Returns the value of attribute id



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def id
  @id
end

#start_dateObject

Returns the value of attribute start_date



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def start_date
  @start_date
end

#statusObject

Returns the value of attribute status



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def status
  @status
end

#typeObject

Returns the value of attribute type



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def type
  @type
end

#warningsObject

Returns the value of attribute warnings



10
11
12
# File 'lib/constantcontact/components/activities/activity.rb', line 10

def warnings
  @warnings
end

Class Method Details

.create(props) ⇒ Activity

Factory method to create an Activity object from a json string

Parameters:

  • props (Hash)
    • properties to create object from

Returns:



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
# File 'lib/constantcontact/components/activities/activity.rb', line 16

def self.create(props)
  obj = Activity.new
  if props
    props.each do |key, value|
      if key == 'errors'
        if value
          obj.errors = []
          value.each do |error|
            obj.errors << Components::ActivityError.create(error)
          end
        end
      elsif key == 'warnings'
        if value
          obj.warnings = []
          value.each do |error|
            obj.warnings << Components::ActivityError.create(error)
          end
        end
      else
        obj.send("#{key}=", value) if obj.respond_to? key
      end
    end
  end
  obj
end