woocommerce_api 1.0.2 → 1.0.3
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.
- data/README.md +1 -0
- data/lib/woocommerce_api/oauth.rb +10 -3
- data/lib/woocommerce_api/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -92,6 +92,7 @@ puts response.headers["x-wc-totalpages"] # Total of pages
|
|
92
92
|
|
93
93
|
## Release History
|
94
94
|
|
95
|
+
- 2015-08-27 - 1.0.3 - Encode all % characters in query string for OAuth 1.0a.
|
95
96
|
- 2015-08-12 - 1.0.2 - Fixed the release date.
|
96
97
|
- 2015-08-12 - 1.0.1 - Escaped oauth_signature in url query string.
|
97
98
|
- 2015-07-15 - 1.0.0 - Stable release.
|
@@ -55,13 +55,11 @@ module WooCommerce
|
|
55
55
|
query_params = []
|
56
56
|
|
57
57
|
params.sort.map do |key, value|
|
58
|
-
query_params.push(
|
58
|
+
query_params.push(encode_param(key.to_s) + "%3D" + encode_param(value.to_s))
|
59
59
|
end
|
60
60
|
|
61
61
|
query_string = query_params
|
62
62
|
.join("%26")
|
63
|
-
.gsub("%5B", "%255B")
|
64
|
-
.gsub("%5D", "%255D")
|
65
63
|
string_to_sign = "#{@method}&#{base_request_uri}&#{query_string}"
|
66
64
|
|
67
65
|
if @version == "v3"
|
@@ -72,5 +70,14 @@ module WooCommerce
|
|
72
70
|
|
73
71
|
return Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), consumer_secret, string_to_sign))
|
74
72
|
end
|
73
|
+
|
74
|
+
# Internal: Encode param
|
75
|
+
#
|
76
|
+
# text - A String to be encoded
|
77
|
+
#
|
78
|
+
# Returns the encoded String.
|
79
|
+
def encode_param(text)
|
80
|
+
CGI::escape(text).gsub('%', '%25')
|
81
|
+
end
|
75
82
|
end
|
76
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woocommerce_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08-
|
12
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|