Sha256: a229e0e781aa60d4b94cc20bb763997aae22b4e1dd4df774d5df0b04aebaa045

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

require 'date'

module Tpaga
class BillingAddress
  attr_accessor :addressLine1, :addressLine2, :city, :country, :postalCode, :state

  # :internal => :external
  def self.attribute_map
    {
      :addressLine1 => :'addressLine1',
      :addressLine2 => :'addressLine2',
      :city => :'city',
      :country => :'country',
      :postalCode => :'postalCode',
      :state => :'state'

    }
  end

  def initialize(attributes = {})
    return if attributes.empty?

    # convert hash key from symbol to string
    # and convert object to hash
    attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
    
    # Morph attribute keys into undescored rubyish style
    if self.class.attribute_map[:"addressLine1"]
      @addressLine1 = attributes["addressLine1"]
      end
    if self.class.attribute_map[:"addressLine2"]
      @addressLine2 = attributes["addressLine2"]
      end
    if self.class.attribute_map[:"city"]
      @city = attributes["city"]
      end
    if self.class.attribute_map[:"country"]
      @country = attributes["country"]
      end
    if self.class.attribute_map[:"postalCode"]
      @postalCode = attributes["postalCode"]
      end
    if self.class.attribute_map[:"state"]
      @state = attributes["state"]
      end
    

  end

  def to_body
    body = {}
    self.class.attribute_map.each_pair do |key, value|
      next if self.send(key).nil?

      if self.send(key).respond_to? :to_body
        body[value] = self.send(key).to_body
      elsif self.send(key).kind_of?(Array)
        body[value] = []
        self.send(key).each do |arr|
           if arr.respond_to? :to_body
               body[value] << arr.to_body
           else
               body[value] << arr
           end
        end
      else
        body[value] = self.send(key)
      end
      
    end
    body
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tpaga-0.0.2 lib/tpaga/models/billingaddress.rb
tpaga-0.0.3 lib/tpaga/models/billingaddress.rb