Skip to content

Instantly share code, notes, and snippets.

@RubyRonin
Created August 23, 2015 21:10
Show Gist options
  • Save RubyRonin/d0aa41800cd9a0c7b6f4 to your computer and use it in GitHub Desktop.
Save RubyRonin/d0aa41800cd9a0c7b6f4 to your computer and use it in GitHub Desktop.
When I conduct an HTTP POST to mydomain.com/api/orders.json?token=mytoken with this body message:
{
"order": {
"line_items": [
{ "variant_id": 1, "quantity": 5 }
]
}
}
I recieve the following:
when body message is json response:
{
"exception": "undefined method `each_key' for [{\"variant_id\"=>1, \"quantity\"=>5}]:Array"
}
when body message is text response:
{
"id": 11,
"number": "R611228487",
"item_total": "0.0",
"total": "0.0",
"ship_total": "0.0",
"state": "cart",
"adjustment_total": "0.0",
"user_id": 2,
"created_at": "2015-08-23T21:10:20.257Z",
"updated_at": "2015-08-23T21:10:20.322Z",
"completed_at": null,
"payment_total": "0.0",
"shipment_state": null,
"payment_state": null,
"email": "sales@mojiapps.com",
"special_instructions": null,
"channel": "spree",
"included_tax_total": "0.0",
"additional_tax_total": "0.0",
"display_included_tax_total": "$0.00",
"display_additional_tax_total": "$0.00",
"tax_total": "0.0",
"currency": "USD",
"display_item_total": "$0.00",
"total_quantity": 0,
"display_total": "$0.00",
"display_ship_total": "$0.00",
"display_tax_total": "$0.00",
"token": "TpZnocFA-yeCrGWCAVG51w",
"checkout_steps": [
"address",
"delivery",
"complete"
],
"permissions": {
"can_update": true
},
"bill_address": null,
"ship_address": null,
"line_items": [],
"payments": [],
"shipments": [],
"adjustments": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment