Class: ConstantContact::Components::EventSpot::RegistrantSection

Inherits:
Component
  • Object
show all
Defined in:
lib/constantcontact/components/event_spot/registrant_section.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Component

#to_hash, to_hash_value, #to_json

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields



11
12
13
# File 'lib/constantcontact/components/event_spot/registrant_section.rb', line 11

def fields
  @fields
end

#labelObject

Returns the value of attribute label



11
12
13
# File 'lib/constantcontact/components/event_spot/registrant_section.rb', line 11

def label
  @label
end

Class Method Details

.create(props) ⇒ RegistrantSection

Factory method to create a RegistrantSection object from a hash

Parameters:

  • props (Hash)
    • hash of properties to create object from

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/constantcontact/components/event_spot/registrant_section.rb', line 16

def self.create(props)
  obj = RegistrantSection.new
  props.each do |key, value|
    key = key.to_s
    if key == 'fields'
      value ||= []
      obj.fields = value.collect do |field|
        Components::EventSpot::RegistrantField.create(field)
      end
    else
      obj.send("#{key}=", value) if obj.respond_to? key
    end
  end if props
  obj
end