Module: Postmen::Common
- Included in:
- Address, Base::CreateLabel, Billing, Postmen::Custom::AES, Postmen::Custom::NoEEI, Postmen::Custom::Passport, Customs, Dimension, Invoice, Item, Money, Parcel, PaymentMethodAccount, ServiceOptionCOD, ServiceOptionGeneral, ServiceOptionInsurance, Shipment, Weight
- Defined in:
- lib/postmen/common.rb
Instance Method Summary collapse
Instance Method Details
#to_hash ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/postmen/common.rb', line 4 def to_hash hash = {} instance_variables.map do |var| value = instance_variable_get(var) if instance_variable_get(var) hash[var[1..-1].to_sym] = if value.is_a?(Array) value.collect{|val| (val.class.to_s.include?('Postmen') ? val.to_hash : val) } else (value.class.to_s.include?('Postmen') ? value.to_hash : value) end end end hash end |