Closed carloslima18 closed 5 years ago
find how work..
substituinfo por...
store = OpenStruct.new(woocommerce_url: "https://alforriamoveis.com.br//wp-json/wc/v3/products/13409?", token:
...
....
response2 = @prod.put('/', {"name": "hello"})
....
You should use:
store = OpenStruct.new(woocommerce_url: "https://alforriamoveis.com.br/", token: "ck_6203256344errhello44", consumer_secret: "cs_d0203256344errhello44")
@prod = WooCommerce::API.new(
store.woocommerce_url,
store.token,
store.consumer_secret,
{
wp_api: true,
version: "wc/v3"
}
)
Since this library will compose this peace wp-json/wc/v3/
, and then you should use @prod.get("products/13409")
.
Also not that there's no parameter name
like in your example '{"name": "hello"}
.
You can find more example in the REST API documentation, there's complete examples for this library: https://woocommerce.github.io/woocommerce-rest-api-docs/?ruby#introduction
prod.post("//wp-json/wc/v3/products/13409", '{"name": "hello"}')
but this not worked
error code: rest_no_route