Reputation: 3258
Using the Ruby Gem - Peddler to access the MWS API. We have to send the ship from address. The documentation says it needs to be a hash, but I can't get this to work..
ship_from_address = {
name: "Schmo",
addressline1: "929 Whatever Dr.",
city: "Fun Town",
stateorprovincecode: "XX",
postalcode: "12345"
}
And here is the actual call to the API with the client setup correctly, because I can access other data where the request is more simple..
plan = client.create_inbound_shipment_plan(ship_from_address,
inbound_shipment_plan_request_items)
And here is the link to the amazon documentation..
This is what the format of the address field looks like when I request it from the API..
{"ShipmentData"=>{"member"=>{"LabelPrepType"=>"SELLER_LABEL",
"DestinationFulfillmentCenterId"=>"IND2", "ShipFromAddress"=>
{"City"=>"XXX", "CountryCode"=>"XX", "PostalCode"=>"12345",
"Name"=>"Schmo", "AddressLine1"=>"3434 Smitherens Rd.",
"StateOrProvinceCode"=>"YY", "AddressLine2"=>"#13A"},
"ShipmentId"=>"FBA37ZLXXX", "AreCasesRequired"=>"false",
"ShipmentName"=>"2015-12-22 09:58", "ShipmentStatus"=>"IN_TRANSIT"}}}
Any ideas?
Upvotes: 0
Views: 263
Reputation: 954
It seems like you need to stick to conventions of naming keys in the hash. The keys of the hash are converted to uppercase, so addressline1
will become Addressline1
, but it should be AddressLine1
. Try to rename the keys like so:
ship_from_address = {
name: "Schmo",
address_line_1: "929 Whatever Dr.",
city: "Fun Town",
state_or_province_code: "XX",
postal_code: "12345"
}
Pay attention to how keys are named in specs of Peddler gem – https://github.com/hakanensari/peddler/blob/master/test/integration/test_fulfillment_inbound_shipment.rb#L5 I think this the cause of the problem.
Upvotes: 1