Skip to content

Instantly share code, notes, and snippets.

@dmichael
Created October 13, 2015 13:20
Show Gist options
  • Save dmichael/5e91fbb99556aa8939a0 to your computer and use it in GitHub Desktop.
Save dmichael/5e91fbb99556aa8939a0 to your computer and use it in GitHub Desktop.
# Load up the JSON file, simulating an API call and deserialization
#
netsuite_order = JSON.parse(File.read('sales_order.json').gsub("\n",""))
# Wrap NetSuite's order representation in our translator
#
order_translator = OrderTranslator.new(netsuite_order)
puts order_translator.to_hash
# {
# :terms=>"NET 30",
# :created_at=>2015-05-05 18:20:00 -0400,
# :subtotal=>#<Money fractional:165000 currency:USD>,
# :items=>[
# {
# :amount=>#<Money fractional:165000 currency:USD>,
# :quantity=>1500
# }
# ]
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment