woocommerce / wc-api-ruby

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

Added http_args option to allow passing arbitrary args to HTTParty. … #29

Closed kirkbowers closed 7 years ago

kirkbowers commented 8 years ago

This is particularly useful to override the default timeout. I find I need to when updating a Product with a large number of gallery images (especially when using S3 for image storage), as the single Product update involves uploading all the images in one batch. This can easily take more than the default 10 seconds, so without this option, will timeout even when working successfully.

Here's a snippet of me using this option:

    @woocommerce = WooCommerce::API.new(
      "http://" + wooconfig['url'],
      wooconfig["consumer_key"], # Your consumer key
      wooconfig["consumer_secret"], # Your consumer secret
      {
        wp_api: true, # Enable the WP REST API integration
        version: "wc/v1",
        debug_mode: false,
        http_args: { timeout: 60 }
      }
    )
claudiosanches commented 7 years ago

Included into 1.4.0 with some changes, see 0d5b588 Thanks.