Class: Economic::Line
Class Method Summary collapse
Methods inherited from Base
add_attribute, add_relation, #dirty?, field, #initialize, low_camel_case, #model_class, relation, #repo, snake_case, #to_h, #values_based_on_hash
Constructor Details
This class inherits a constructor from Economic::Base
Class Method Details
.build_from_soap_api(data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/economic/line.rb', line 18 def self.build_from_soap_api(data) # This is not instantiated with the hash, as lines are never pulled out by themselves, but always as part of # a invoice or order { "lineNumber" => data[:number].to_i, "description" => data[:description], "quantity" => data[:quantity].to_f, "unitNetPrice" => data[:unit_net_price].to_f, "discountPercentage" => data[:discount_as_percent].to_f, "unitCostPrice" => data[:unit_cost_price].to_f, "totalNetAmount" => data[:total_net_amount].to_f, "marginPercentage" => data[:margin_as_percent].to_f, "marginInBaseCurrency" => data[:total_margin].to_f, "product" => {"productNumber" => data[:product_handle][:number]}, # Unmapped values in soap # delivery_date # :accrual_start_date => nil, # :accrual_end_date => nil } end |