Convert Curl command line in Rails -
this curl command works nicely in command line :
curl --data @order_new.json \ -h "x-augury-token:my_token_goes_here" \ -h "content-type:application/json" \ http://staging.hub.spreecommerce.com/api/stores/store_id_goes_here/messages
i need implement same in rails using sort of gem, tried httparty /rest_client / spree-api-client, wrong here :
require 'httparty' result = httparty.post( "http://staging.hub.spreecommerce.com/api/stores/52eb347f755b1c97e900001e/messages", :body => json.parse(file.read("order_new.json")), :header => { "x-augury-token" => "ujjksdxbrwjpapx9hiw4", "content-type" => "application/json" } )
but getting error,
"the page looking doesn't exist (404)"
i need rails equivalent of above curl command, use of spree-api-client gem helpful.
if prefer use spree::api::client
, post results of findings? evaluate output of following commands , post back:
client = spree::api::client.new('http://staging.hub.spreecommerce.com/api/', 'ujjksdxbrwjpapx9hiw4') client.products.inspect
Comments
Post a Comment