class ConstantContact::Components::Activity

Attributes

contact_count[RW]
created_date[RW]
error_count[RW]
errors[RW]
file_name[RW]
finish_date[RW]
id[RW]
start_date[RW]
status[RW]
type[RW]
warnings[RW]

Public Class Methods

create(props) click to toggle source

Factory method to create an Activity object from a json string @param [Hash] props - properties to create object from @return [Activity]

# 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