woocommerce / wc-api-ruby

A Ruby wrapper for the WooCommerce API.
MIT License
69 stars 73 forks source link

How could I use proxy to call an APIs #60

Open babarajay opened 7 months ago

babarajay commented 7 months ago

Description: I have a condition where I wanted to use proxy to call woo commerce APIs. I went thru the open/closed issues but I could not get anything related to it so raising a new one.

Any help would be appreciated.

Thank you.

raoulalwani commented 1 month ago

If @babarajay or anyone else is looking for how to do this, you can pass in httparty_args as an option:

woocommerce = WooCommerce::API.new(
  "http://example.com",
  "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  {
    wp_api: true,
    version: "wc/v3",
    httparty_args: {
      http_proxyaddr: "yourproxydomain.com",
      http_proxyport: 80, # or whatever your proxy port is
      http_proxyuser: "username",
      http_proxypass: "password"
    }
  }
)
babarajay commented 1 month ago

@raoulalwani thanks buddy!