woocommerce_api 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -6
- data/lib/woocommerce_api.rb +17 -4
- data/lib/woocommerce_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e10672f2246b6da09dcfb1fa118ffb211bba22
|
4
|
+
data.tar.gz: b46077f27945fcc5477bfb2592feb227454111de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
|
63
|
-
|
64
|
-
| `wp_api`
|
65
|
-
| `version`
|
66
|
-
| `verify_ssl`
|
67
|
-
| `signature_method`
|
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.
|
data/lib/woocommerce_api.rb
CHANGED
@@ -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
|
-
|
134
|
-
|
135
|
-
|
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)
|
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.
|
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-
|
11
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|