Class: ConstantContact::Components::EventSpot::RegistrantOrder

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

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Component

#to_hash, to_hash_value, #to_json

Instance Attribute Details

#currency_typeObject

Returns the value of attribute currency_type



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

def currency_type
  @currency_type
end

#feesObject

Returns the value of attribute fees



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

def fees
  @fees
end

#itemsObject

Returns the value of attribute items



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

def items
  @items
end

#order_dateObject

Returns the value of attribute order_date



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

def order_date
  @order_date
end

#order_idObject

Returns the value of attribute order_id



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

def order_id
  @order_id
end

#totalObject

Returns the value of attribute total



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

def total
  @total
end

Class Method Details

.create(props) ⇒ RegistrantOrder

Factory method to create a RegistrantOrder 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
31
32
33
34
35
# File 'lib/constantcontact/components/event_spot/registrant_order.rb', line 16

def self.create(props)
  obj = RegistrantOrder.new
  props.each do |key, value|
    key = key.to_s
    if key == 'fees'
      value ||= []
      obj.fees = value.collect do |fee|
        Components::EventSpot::RegistrantFee.create(fee)
      end
    elsif key == 'items'
      value ||= []
      obj.items = value.collect do |item|
        Components::EventSpot::SaleItem.create(item)
      end
    else
      obj.send("#{key}=", value) if obj.respond_to? key
    end
  end if props
  obj
end