class Taxamo::CustomFields

Attributes

key[RW]
value[RW]

Public Class Methods

attribute_map() click to toggle source

:internal => :external

# File lib/taxamo/models/customfields.rb, line 18
def self.attribute_map
  {
    :key => :key,
    :value => :value

  }
end
new(attributes = {}) click to toggle source
# File lib/taxamo/models/customfields.rb, line 26
def initialize(attributes = {})
  return if attributes.nil? or attributes.empty?
  # Morph attribute keys into undescored rubyish style
  if attributes.key?("key")
    @key = attributes["key"]
      
  end
  if attributes.key?("value")
    @value = attributes["value"]
      
  end
  

end

Public Instance Methods

to_body() click to toggle source
# File lib/taxamo/models/customfields.rb, line 41
def to_body
  body = {}
  self.class.attribute_map.each_pair do |key, value|
    v = self.send(key)
    unless v.nil?
      if v.is_a?(Array)
        array = Array.new
        v.each do |item|
          if item.respond_to?("to_body".to_sym)
            array.push item.to_body
          else
            array.push item
          end
        end
        body[value] = array
      else
        if v.respond_to?("to_body".to_sym)
          body[value] = v.to_body
        else
          body[value] = v
        end
      end
    end
  end
  body
end