Sha256: 095c6069057bb127413f3bbdcf5c8f6d7204c26e6a0970b1572e82dd93022321

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

#
# registrant_order.rb
# ConstantContact
#
# Copyright (c) 2013 Constant Contact. All rights reserved.

module ConstantContact
  module Components
    module EventSpot
      class RegistrantOrder < Component
        attr_accessor :currency_type, :fees, :items, :order_id, :order_date, :total

        # Factory method to create a RegistrantOrder object from a hash
        # @param [Hash] props - hash of properties to create object from
        # @return [RegistrantOrder]
        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
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
constantcontact-4.0.0 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-3.0.0 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-2.2.1 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-ruby-2.2.1 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-ruby-2.2.0 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-2.2.0 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-2.1.0 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-2.0.1 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-2.0.0 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-1.3.2 lib/constantcontact/components/event_spot/registrant_order.rb
constantcontact-1.2.0 lib/constantcontact/components/event_spot/registrant_order.rb