woocommerce_api 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd290bde8c41792cc2cdd5882833ab4c562fa9d1
4
- data.tar.gz: 54198808cad5e99f7267e0ed2a839fc87d84e1ca
3
+ metadata.gz: 90e10672f2246b6da09dcfb1fa118ffb211bba22
4
+ data.tar.gz: b46077f27945fcc5477bfb2592feb227454111de
5
5
  SHA512:
6
- metadata.gz: 070d7c81734c8ee249ad9ddeb5ee9dd00d63a047262402b88e75d400eef0ac696c43f4b188a855031d6abfb156285f41a0009ebd66cab80f93a9bb94f5a2e2c7
7
- data.tar.gz: 336bb75d61166e2dac0f040225a145c04c5e6967ef9dcf3cc00e13cd9c95b8ff8e7772d9be7f18a2bd7512f67921e602549b81e9a1859118262514b8908f1000
6
+ metadata.gz: f4b3b16a8f5174d0a01234c939a5e580b1b50e068ee5d4d81905caf65d5c976022a0de21e195d6f4bbf52a053bf87ae64c23950959ed84c427126c25f3bb481c
7
+ data.tar.gz: abd9c524c195134f5d70516feda74bffd9d1c0d4dbce49c162654185b6c570753c1fa630c4ea417acef4539931ec9805758854740f690ba5aa001ebc2e02dcd9
data/README.md CHANGED
@@ -59,12 +59,14 @@ woocommerce = WooCommerce::API.new(
59
59
 
60
60
  #### Args options
61
61
 
62
- | Option | Type | Required | Description |
63
- |--------------------|----------|----------|--------------------------------------------------------------------------------------------------------------|
64
- | `wp_api` | `Bool` | no | Allow requests to the WP REST API (WooCommerce 2.6 or later) |
65
- | `version` | `String` | no | API version, default is `v3` |
66
- | `verify_ssl` | `Bool` | no | Verify SSL when connect, use this option as `false` when need to test with self-signed certificates |
67
- | `signature_method` | `String` | no | Signature method used for oAuth requests, works with `HMAC-SHA1` and `HMAC-SHA256`, default is `HMAC-SHA256` |
62
+ | Option | Type | Required | Description |
63
+ |---------------------|----------|----------|--------------------------------------------------------------------------------------------------------------|
64
+ | `wp_api` | `Bool` | no | Allow requests to the WP REST API (WooCommerce 2.6 or later) |
65
+ | `version` | `String` | no | API version, default is `v3` |
66
+ | `verify_ssl` | `Bool` | no | Verify SSL when connect, use this option as `false` when need to test with self-signed certificates |
67
+ | `signature_method` | `String` | no | Signature method used for oAuth requests, works with `HMAC-SHA1` and `HMAC-SHA256`, default is `HMAC-SHA256` |
68
+ | `query_string_auth` | `Bool` | no | Force Basic Authentication as query string when `true` and using under HTTPS, default is `false` |
69
+ | `debug_mode` | `Bool` | no | Enables HTTParty debug mode |
68
70
 
69
71
  ## Methods
70
72
 
@@ -116,6 +118,7 @@ puts response.headers["x-wc-totalpages"] # Total of pages
116
118
 
117
119
  ## Release History
118
120
 
121
+ - 2016-09-15 - 1.3.0 - Added the `query_string_auth` and `debug_mode` options.
119
122
  - 2016-06-26 - 1.2.1 - Fixed oAuth signature for WP REST API.
120
123
  - 2016-05-09 - 1.2.0 - Added support for WP REST API and added method to do HTTP OPTIONS requests.
121
124
  - 2015-12-07 - 1.1.2 - Stop send `body` in GET and DELETE requests.
@@ -26,6 +26,8 @@ module WooCommerce
26
26
  @version = args[:version]
27
27
  @verify_ssl = args[:verify_ssl] == true
28
28
  @signature_method = args[:signature_method]
29
+ @debug_mode = args[:debug_mode]
30
+ @query_string_auth = args[:query_string_auth]
29
31
 
30
32
  # Internal args
31
33
  @is_ssl = @url.start_with? "https"
@@ -129,12 +131,23 @@ module WooCommerce
129
131
  "Accept" => "application/json"
130
132
  }
131
133
  }
134
+
135
+ # Set basic authentication.
132
136
  if @is_ssl
133
- options.merge!(basic_auth: {
134
- username: @consumer_key,
135
- password: @consumer_secret
136
- })
137
+ if @query_string_auth
138
+ options.merge!(query: {
139
+ consumer_key: @consumer_key,
140
+ consumer_secret: @consumer_secret
141
+ })
142
+ else
143
+ options.merge!(basic_auth: {
144
+ username: @consumer_key,
145
+ password: @consumer_secret
146
+ })
147
+ end
137
148
  end
149
+
150
+ options.merge!(debug_output: $stdout) if @debug_mode
138
151
  options.merge!(body: data.to_json) if !data.empty?
139
152
 
140
153
  HTTParty.send(method, url, options)
@@ -1,3 +1,3 @@
1
1
  module WooCommerce
2
- VERSION = '1.2.1'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woocommerce_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Sanches
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty