class Taxamo::InputTransactionLine
Attributes
amount[RW]
custom_fields[RW]
custom_id[RW]
deducted_tax_rate[RW]
description[RW]
informative[RW]
line_key[RW]
product_code[RW]
product_tax_code[RW]
product_type[RW]
quantity[RW]
supply_date[RW]
tax_name[RW]
tax_rate[RW]
total_amount[RW]
unit_of_measure[RW]
unit_price[RW]
Public Class Methods
attribute_map()
click to toggle source
:internal => :external
# File lib/taxamo/models/inputtransactionline.rb, line 18 def self.attribute_map { :product_type => :product_type, :deducted_tax_rate => :deducted_tax_rate, :supply_date => :supply_date, :unit_price => :unit_price, :unit_of_measure => :unit_of_measure, :quantity => :quantity, :custom_fields => :custom_fields, :line_key => :line_key, :tax_name => :tax_name, :product_code => :product_code, :amount => :amount, :custom_id => :custom_id, :informative => :informative, :tax_rate => :tax_rate, :total_amount => :total_amount, :product_tax_code => :product_tax_code, :description => :description } end
new(attributes = {})
click to toggle source
# File lib/taxamo/models/inputtransactionline.rb, line 41 def initialize(attributes = {}) return if attributes.nil? or attributes.empty? # Morph attribute keys into undescored rubyish style if attributes.key?("product_type") @product_type = attributes["product_type"] end if attributes.key?("deducted_tax_rate") @deducted_tax_rate = attributes["deducted_tax_rate"] end if attributes.key?("supply_date") @supply_date = attributes["supply_date"] end if attributes.key?("unit_price") @unit_price = attributes["unit_price"] end if attributes.key?("unit_of_measure") @unit_of_measure = attributes["unit_of_measure"] end if attributes.key?("quantity") @quantity = attributes["quantity"] end if attributes.key?("custom_fields") if (value = attributes["custom_fields"]).is_a?(Array) @custom_fields = value.map{ |v| CustomFields.new(v) } end end if attributes.key?("line_key") @line_key = attributes["line_key"] end if attributes.key?("tax_name") @tax_name = attributes["tax_name"] end if attributes.key?("product_code") @product_code = attributes["product_code"] end if attributes.key?("amount") @amount = attributes["amount"] end if attributes.key?("custom_id") @custom_id = attributes["custom_id"] end if attributes.key?("informative") @informative = attributes["informative"] end if attributes.key?("tax_rate") @tax_rate = attributes["tax_rate"] end if attributes.key?("total_amount") @total_amount = attributes["total_amount"] end if attributes.key?("product_tax_code") @product_tax_code = attributes["product_tax_code"] end if attributes.key?("description") @description = attributes["description"] end end
Public Instance Methods
to_body()
click to toggle source
# File lib/taxamo/models/inputtransactionline.rb, line 117 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