woocommerce-ruby3-api 1.5.0 → 1.5.2
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 +7 -3
- data/lib/woocommerce-ruby3-api.rb +1 -1
- data/lib/woocommerce_api/oauth.rb +62 -32
- data/lib/woocommerce_api/version.rb +1 -1
- data/lib/woocommerce_api.rb +153 -116
- data/woocommerce-ruby3-api.gemspec +10 -14
- metadata +18 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 881185e578b5ac0cc7befe360c066912d3968618812133654d56c3db3f389e79
|
4
|
+
data.tar.gz: e379ba148da036fba958912c8079873a22bbfebf71faf0aec76560a0dd56e8f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67d20be2d1f5179b2045cbe80b1d5fc209c873c21537f0cc362fd2fcadbe6f87ede8e4000c3b1d43eaae4675c6d36074f8288b29cf56537d34affbdfdf01a08
|
7
|
+
data.tar.gz: 6267243d74dc3ceb5775cba2a9388b441b8abad34b2f068318f5a6e79d1f387cc6231f105b51853ab9800cdc2c2574dacd0eb0bdc4cda2bc98ba4bb10d67abd6
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
A Ruby wrapper for the WooCommerce REST API. Easily interact with the WooCommerce REST API using this library, optimized for Ruby 3.0+.
|
4
4
|
|
5
|
-
[](https://badge.fury.io/rb/woocommerce-ruby3-api)
|
6
|
-
[](https://github.com/chemica/woocommerce-ruby3-api/actions/workflows/test.yml)
|
5
|
+
[](https://badge.fury.io/rb/woocommerce-ruby3-api)
|
6
|
+
[](https://github.com/chemica/woocommerce-ruby3-api/actions/workflows/test.yml)
|
7
7
|
|
8
8
|
## About
|
9
9
|
|
@@ -208,7 +208,9 @@ puts response.headers["x-wc-totalpages"] # Total of pages
|
|
208
208
|
## Release History
|
209
209
|
|
210
210
|
### Ruby 3 Version (woocommerce-ruby3-api)
|
211
|
-
- 2025-
|
211
|
+
- 2025-04-11 - 1.5.2 - Fixes gemfile.lock issue.
|
212
|
+
- 2025-04-11 - 1.5.1 - Adds RuboCop for code quality. Fixes RuboCop violations. Refactors code and tests for easier maintainability.
|
213
|
+
- 2025-04-10 - 1.5.0 - Update code for Ruby 3.1+ compatibility using Addressable::URI and base64 gem. Add Github CI actions.
|
212
214
|
|
213
215
|
### Original Project (woocommerce_api)
|
214
216
|
- 2016-12-14 - 1.4.0 - Introduces `httparty_args` arg and fixed compatibility with WordPress 4.7.
|
@@ -232,6 +234,8 @@ puts response.headers["x-wc-totalpages"] # Total of pages
|
|
232
234
|
4. Push to the branch (`git push origin my-new-feature`)
|
233
235
|
5. Create new Pull Request
|
234
236
|
|
237
|
+
Adding an issue to start a discussion about your change would be appreciated.
|
238
|
+
|
235
239
|
## License
|
236
240
|
|
237
241
|
Released under the [MIT License](LICENSE).
|
@@ -11,46 +11,74 @@ module WooCommerce
|
|
11
11
|
class OAuth
|
12
12
|
class InvalidSignatureMethodError < StandardError; end
|
13
13
|
|
14
|
-
|
14
|
+
NONCE_LIFETIME = 15 * 60 # Woocommerce keeps nonces for 15 minutes
|
15
|
+
|
16
|
+
def initialize(url, method, version, credentials)
|
15
17
|
@url = url
|
16
18
|
@method = method.upcase
|
17
19
|
@version = version
|
18
|
-
@consumer_key = consumer_key
|
19
|
-
@consumer_secret = consumer_secret
|
20
|
-
@signature_method = signature_method
|
20
|
+
@consumer_key = credentials[:consumer_key]
|
21
|
+
@consumer_secret = credentials[:consumer_secret]
|
22
|
+
@signature_method = credentials[:signature_method]
|
21
23
|
end
|
22
24
|
|
23
25
|
# Public: Get OAuth url
|
24
26
|
#
|
25
27
|
# Returns the OAuth url.
|
26
|
-
def
|
28
|
+
def oauth_url
|
27
29
|
params = {}
|
28
30
|
url = @url
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
url = parse_params(url, params)
|
33
|
+
create_oauth_params(params, url)
|
34
|
+
|
35
|
+
query_string = create_query_string(params)
|
36
|
+
|
37
|
+
"#{url}?#{query_string}"
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
36
41
|
|
37
|
-
|
42
|
+
def parse_params(url, params)
|
43
|
+
return url unless url.include?("?")
|
44
|
+
|
45
|
+
parsed_url = URI.parse(url)
|
46
|
+
CGI.parse(parsed_url.query).each do |key, value|
|
47
|
+
params[key] = value[0]
|
38
48
|
end
|
49
|
+
params = params.sort.to_h
|
50
|
+
|
51
|
+
parsed_url.to_s.gsub(/\?.*/, "")
|
52
|
+
end
|
39
53
|
|
40
|
-
|
54
|
+
# Internal: Create the query string
|
55
|
+
#
|
56
|
+
# params - A Hash with the OAuth params.
|
57
|
+
#
|
58
|
+
# Returns the query string String.
|
59
|
+
def create_query_string(params)
|
60
|
+
Addressable::URI.encode(params.map { |key, value| "#{key}=#{value}" }.join("&"))
|
61
|
+
end
|
41
62
|
|
63
|
+
# Internal: Create the OAuth params
|
64
|
+
#
|
65
|
+
# params - A Hash with the OAuth params.
|
66
|
+
#
|
67
|
+
# Updates and returns the OAuth params Hash.
|
68
|
+
def create_oauth_params(params, url)
|
42
69
|
params["oauth_consumer_key"] = @consumer_key
|
43
|
-
params["oauth_nonce"] =
|
70
|
+
params["oauth_nonce"] = generate_nonce
|
44
71
|
params["oauth_signature_method"] = @signature_method
|
45
72
|
params["oauth_timestamp"] = Time.new.to_i
|
46
|
-
params["oauth_signature"] = CGI
|
47
|
-
|
48
|
-
query_string = Addressable::URI.encode(params.map{|key, value| "#{key}=#{value}"}.join("&"))
|
49
|
-
|
50
|
-
"#{url}?#{query_string}"
|
73
|
+
params["oauth_signature"] = CGI.escape(generate_oauth_signature(params, url))
|
51
74
|
end
|
52
75
|
|
53
|
-
|
76
|
+
# Internal: Generate a nonce
|
77
|
+
#
|
78
|
+
# Returns the nonce String.
|
79
|
+
def generate_nonce
|
80
|
+
Digest::SHA1.hexdigest(((Time.new.to_f % NONCE_LIFETIME) + (Process.pid * NONCE_LIFETIME)).to_s)
|
81
|
+
end
|
54
82
|
|
55
83
|
# Internal: Generate the OAuth Signature
|
56
84
|
#
|
@@ -58,25 +86,27 @@ module WooCommerce
|
|
58
86
|
# url - A String with a URL
|
59
87
|
#
|
60
88
|
# Returns the oauth signature String.
|
61
|
-
def generate_oauth_signature
|
62
|
-
base_request_uri = CGI
|
89
|
+
def generate_oauth_signature(params, url)
|
90
|
+
base_request_uri = CGI.escape(url.to_s)
|
63
91
|
query_params = []
|
64
92
|
|
65
93
|
params.sort.map do |key, value|
|
66
|
-
query_params.push(encode_param(key.to_s)
|
94
|
+
query_params.push("#{encode_param(key.to_s)}%3D#{encode_param(value.to_s)}")
|
67
95
|
end
|
68
96
|
|
69
97
|
query_string = query_params
|
70
|
-
|
98
|
+
.join("%26")
|
71
99
|
string_to_sign = "#{@method}&#{base_request_uri}&#{query_string}"
|
72
100
|
|
73
|
-
|
74
|
-
|
101
|
+
Base64.strict_encode64(OpenSSL::HMAC.digest(digest, consumer_secret, string_to_sign))
|
102
|
+
end
|
103
|
+
|
104
|
+
def consumer_secret
|
105
|
+
if ["v1", "v2"].include? @version
|
106
|
+
@consumer_secret
|
75
107
|
else
|
76
|
-
|
108
|
+
"#{@consumer_secret}&"
|
77
109
|
end
|
78
|
-
|
79
|
-
return Base64.strict_encode64(OpenSSL::HMAC.digest(digest, consumer_secret, string_to_sign))
|
80
110
|
end
|
81
111
|
|
82
112
|
# Internal: Digest object based on signature method
|
@@ -87,7 +117,7 @@ module WooCommerce
|
|
87
117
|
when "HMAC-SHA256" then OpenSSL::Digest.new("sha256")
|
88
118
|
when "HMAC-SHA1" then OpenSSL::Digest.new("sha1")
|
89
119
|
else
|
90
|
-
|
120
|
+
raise InvalidSignatureMethodError
|
91
121
|
end
|
92
122
|
end
|
93
123
|
|
@@ -96,8 +126,8 @@ module WooCommerce
|
|
96
126
|
# text - A String to be encoded
|
97
127
|
#
|
98
128
|
# Returns the encoded String.
|
99
|
-
def encode_param
|
100
|
-
CGI
|
129
|
+
def encode_param(text)
|
130
|
+
CGI.escape(text).gsub("+", "%20").gsub("%", "%25")
|
101
131
|
end
|
102
132
|
end
|
103
133
|
end
|
data/lib/woocommerce_api.rb
CHANGED
@@ -3,101 +3,74 @@
|
|
3
3
|
require "httparty"
|
4
4
|
require "json"
|
5
5
|
require "cgi"
|
6
|
-
require "cgi"
|
7
6
|
require "addressable/uri"
|
8
7
|
|
9
8
|
require "woocommerce_api/oauth"
|
10
9
|
require "woocommerce_api/version"
|
11
10
|
|
12
11
|
module WooCommerce
|
13
|
-
class
|
14
|
-
|
15
|
-
|
12
|
+
class ApiBase
|
13
|
+
DEFAULT_ARGS = {
|
14
|
+
wp_api: false,
|
15
|
+
version: "v3",
|
16
|
+
verify_ssl: true,
|
17
|
+
signature_method: "HMAC-SHA256",
|
18
|
+
httparty_args: {}
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
def initialize(url, consumer_key, consumer_secret, args = {})
|
16
22
|
# Required args
|
17
23
|
@url = url
|
18
24
|
@consumer_key = consumer_key
|
19
25
|
@consumer_secret = consumer_secret
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
wp_api: false,
|
24
|
-
version: "v3",
|
25
|
-
verify_ssl: true,
|
26
|
-
signature_method: "HMAC-SHA256",
|
27
|
-
httparty_args: {}
|
28
|
-
}
|
29
|
-
args = defaults.merge(args)
|
30
|
-
|
31
|
-
@wp_api = args[:wp_api]
|
32
|
-
@version = args[:version]
|
33
|
-
@verify_ssl = args[:verify_ssl] == true
|
34
|
-
@signature_method = args[:signature_method]
|
35
|
-
@debug_mode = args[:debug_mode]
|
36
|
-
@query_string_auth = args[:query_string_auth]
|
37
|
-
@httparty_args = args[:httparty_args]
|
27
|
+
args = DEFAULT_ARGS.merge(args)
|
28
|
+
create_args_variables(args)
|
38
29
|
|
39
30
|
# Internal args
|
40
31
|
@is_ssl = @url.start_with? "https"
|
41
32
|
end
|
42
33
|
|
43
|
-
|
44
|
-
#
|
45
|
-
# endpoint - A String naming the request endpoint.
|
46
|
-
# query - A Hash with query params.
|
47
|
-
#
|
48
|
-
# Returns the request Hash.
|
49
|
-
def get endpoint, query = nil
|
50
|
-
do_request :get, add_query_params(endpoint, query)
|
51
|
-
end
|
34
|
+
private
|
52
35
|
|
53
|
-
#
|
36
|
+
# Internal: Sets authentication options for SSL requests
|
54
37
|
#
|
55
|
-
#
|
56
|
-
# data - The Hash data for the request.
|
38
|
+
# options - The options hash to modify with authentication settings
|
57
39
|
#
|
58
|
-
# Returns the
|
59
|
-
def
|
60
|
-
|
61
|
-
end
|
40
|
+
# Returns the modified options hash
|
41
|
+
def authentication_options(options)
|
42
|
+
options[:verify] = @verify_ssl
|
62
43
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
def put endpoint, data
|
70
|
-
do_request :put, endpoint, data
|
71
|
-
end
|
72
|
-
|
73
|
-
# Public: DELETE requests.
|
74
|
-
#
|
75
|
-
# endpoint - A String naming the request endpoint.
|
76
|
-
# query - A Hash with query params.
|
77
|
-
#
|
78
|
-
# Returns the request Hash.
|
79
|
-
def delete endpoint, query = nil
|
80
|
-
do_request :delete, add_query_params(endpoint, query)
|
44
|
+
if @query_string_auth
|
45
|
+
options[:query] = { consumer_key: @consumer_key, consumer_secret: @consumer_secret }
|
46
|
+
else
|
47
|
+
options[:basic_auth] = { username: @consumer_key, password: @consumer_secret }
|
48
|
+
end
|
49
|
+
options
|
81
50
|
end
|
82
51
|
|
83
|
-
#
|
52
|
+
# Internal: Creates instance variables from a hash of arguments
|
84
53
|
#
|
85
|
-
#
|
54
|
+
# args - A hash of arguments to create instance variables from
|
86
55
|
#
|
87
|
-
# Returns
|
88
|
-
def
|
89
|
-
|
56
|
+
# Returns nothing
|
57
|
+
def create_args_variables(args)
|
58
|
+
@wp_api = args[:wp_api]
|
59
|
+
@version = args[:version]
|
60
|
+
@verify_ssl = args[:verify_ssl] == true
|
61
|
+
@signature_method = args[:signature_method]
|
62
|
+
@debug_mode = args[:debug_mode]
|
63
|
+
@query_string_auth = args[:query_string_auth]
|
64
|
+
@httparty_args = args[:httparty_args]
|
90
65
|
end
|
91
66
|
|
92
|
-
protected
|
93
|
-
|
94
67
|
# Internal: Appends data as query params onto an endpoint
|
95
68
|
#
|
96
69
|
# endpoint - A String naming the request endpoint.
|
97
70
|
# data - A hash of data to flatten and append
|
98
71
|
#
|
99
72
|
# Returns an endpoint string with the data appended
|
100
|
-
def add_query_params
|
73
|
+
def add_query_params(endpoint, data)
|
101
74
|
return endpoint if data.nil? || data.empty?
|
102
75
|
|
103
76
|
endpoint += "?" unless endpoint.include? "?"
|
@@ -111,8 +84,8 @@ module WooCommerce
|
|
111
84
|
# method - The method used in the url (for oauth querys)
|
112
85
|
#
|
113
86
|
# Returns the endpoint String.
|
114
|
-
def get_url
|
115
|
-
api = @wp_api ?
|
87
|
+
def get_url(endpoint, method)
|
88
|
+
api = @wp_api ? "wp-json" : "wc-api"
|
116
89
|
url = @url
|
117
90
|
url = "#{url}/" unless url.end_with? "/"
|
118
91
|
url = "#{url}#{api}/#{@version}/#{endpoint}"
|
@@ -120,6 +93,56 @@ module WooCommerce
|
|
120
93
|
@is_ssl ? url : oauth_url(url, method)
|
121
94
|
end
|
122
95
|
|
96
|
+
# Internal: Generates an oauth url given current settings
|
97
|
+
#
|
98
|
+
# url - A String naming the current request url
|
99
|
+
# method - The HTTP verb of the request
|
100
|
+
#
|
101
|
+
# Returns a url to be used for the query.
|
102
|
+
def oauth_url(url, method)
|
103
|
+
oauth = WooCommerce::OAuth.new(
|
104
|
+
url,
|
105
|
+
method,
|
106
|
+
@version,
|
107
|
+
{
|
108
|
+
consumer_key: @consumer_key, consumer_secret: @consumer_secret,
|
109
|
+
signature_method: @signature_method
|
110
|
+
}
|
111
|
+
)
|
112
|
+
oauth.oauth_url
|
113
|
+
end
|
114
|
+
|
115
|
+
# Internal: Flattens a hash into an array of query relations
|
116
|
+
#
|
117
|
+
# hash - A hash to flatten
|
118
|
+
#
|
119
|
+
# Returns an array full of key value paired strings
|
120
|
+
def flatten_hash(hash)
|
121
|
+
hash.flat_map do |key, value|
|
122
|
+
case value
|
123
|
+
when Hash
|
124
|
+
remap_to_inner_hash(key, value)
|
125
|
+
when Array
|
126
|
+
value.map { |inner_value| "#{key}[]=#{inner_value}" }
|
127
|
+
else
|
128
|
+
"#{key}=#{value}"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Internal: Remaps a hash to an array of key value paired strings
|
134
|
+
# used internally for flatten_hash
|
135
|
+
#
|
136
|
+
# key - A String naming the key
|
137
|
+
# value - A Hash to remap
|
138
|
+
#
|
139
|
+
# Returns an array full of key value paired strings
|
140
|
+
def remap_to_inner_hash(key, value)
|
141
|
+
value.map do |inner_key, inner_value|
|
142
|
+
"#{key}[#{inner_key}]=#{inner_value}"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
123
146
|
# Internal: Requests default options.
|
124
147
|
#
|
125
148
|
# method - A String naming the request method
|
@@ -127,7 +150,7 @@ module WooCommerce
|
|
127
150
|
# data - The Hash data for the request.
|
128
151
|
#
|
129
152
|
# Returns the response in JSON String.
|
130
|
-
def do_request
|
153
|
+
def do_request(method, endpoint, data = {})
|
131
154
|
url = get_url(endpoint, method)
|
132
155
|
options = {
|
133
156
|
format: :json
|
@@ -136,72 +159,86 @@ module WooCommerce
|
|
136
159
|
# Allow custom HTTParty args.
|
137
160
|
options = options.merge(@httparty_args)
|
138
161
|
|
139
|
-
|
162
|
+
add_headers(options, data)
|
163
|
+
authentication_options(options) if @is_ssl
|
164
|
+
|
165
|
+
options[:debug_output] = $stdout if @debug_mode
|
166
|
+
options[:body] = data.to_json unless data.empty?
|
167
|
+
|
168
|
+
HTTParty.send(method, url, options)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Internal: Adds headers to the request options
|
172
|
+
# used internally for do_request
|
173
|
+
#
|
174
|
+
# options - The options hash to modify with headers
|
175
|
+
# data - The data for the request
|
176
|
+
#
|
177
|
+
# Returns the modified options hash
|
178
|
+
def add_headers(options, data)
|
140
179
|
options[:headers] = {
|
141
180
|
"User-Agent" => "WooCommerce API Client-Ruby/#{WooCommerce::VERSION}",
|
142
181
|
"Accept" => "application/json"
|
143
182
|
}
|
144
|
-
options[:headers]["Content-Type"] = "application/json;charset=utf-8"
|
183
|
+
options[:headers]["Content-Type"] = "application/json;charset=utf-8" unless data.empty?
|
184
|
+
end
|
185
|
+
end
|
145
186
|
|
146
|
-
|
147
|
-
|
148
|
-
|
187
|
+
# Initialize the API class
|
188
|
+
#
|
189
|
+
# @param url [String] The base URL of the WooCommerce store
|
190
|
+
# @param consumer_key [String] The consumer key for the API
|
191
|
+
# @param consumer_secret [String] The consumer secret for the API
|
192
|
+
# @param args [Hash] Additional configuration options
|
149
193
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
end
|
161
|
-
end
|
194
|
+
class API < ApiBase
|
195
|
+
# Public: GET requests.
|
196
|
+
#
|
197
|
+
# endpoint - A String naming the request endpoint.
|
198
|
+
# query - A Hash with query params.
|
199
|
+
#
|
200
|
+
# Returns the request Hash.
|
201
|
+
def get(endpoint, query = nil)
|
202
|
+
do_request :get, add_query_params(endpoint, query)
|
203
|
+
end
|
162
204
|
|
163
|
-
|
164
|
-
|
205
|
+
# Public: POST requests.
|
206
|
+
#
|
207
|
+
# endpoint - A String naming the request endpoint.
|
208
|
+
# data - The Hash data for the request.
|
209
|
+
#
|
210
|
+
# Returns the request Hash.
|
211
|
+
def post(endpoint, data)
|
212
|
+
do_request :post, endpoint, data
|
213
|
+
end
|
165
214
|
|
166
|
-
|
215
|
+
# Public: PUT requests.
|
216
|
+
#
|
217
|
+
# endpoint - A String naming the request endpoint.
|
218
|
+
# data - The Hash data for the request.
|
219
|
+
#
|
220
|
+
# Returns the request Hash.
|
221
|
+
def put(endpoint, data)
|
222
|
+
do_request :put, endpoint, data
|
167
223
|
end
|
168
224
|
|
169
|
-
#
|
225
|
+
# Public: DELETE requests.
|
170
226
|
#
|
171
|
-
#
|
172
|
-
#
|
227
|
+
# endpoint - A String naming the request endpoint.
|
228
|
+
# query - A Hash with query params.
|
173
229
|
#
|
174
|
-
# Returns
|
175
|
-
def
|
176
|
-
|
177
|
-
url,
|
178
|
-
method,
|
179
|
-
@version,
|
180
|
-
@consumer_key,
|
181
|
-
@consumer_secret,
|
182
|
-
@signature_method
|
183
|
-
)
|
184
|
-
oauth.get_oauth_url
|
230
|
+
# Returns the request Hash.
|
231
|
+
def delete(endpoint, query = nil)
|
232
|
+
do_request :delete, add_query_params(endpoint, query)
|
185
233
|
end
|
186
234
|
|
187
|
-
#
|
235
|
+
# Public: OPTIONS requests.
|
188
236
|
#
|
189
|
-
#
|
237
|
+
# endpoint - A String naming the request endpoint.
|
190
238
|
#
|
191
|
-
# Returns
|
192
|
-
def
|
193
|
-
|
194
|
-
case value
|
195
|
-
when Hash
|
196
|
-
value.map do |inner_key, inner_value|
|
197
|
-
"#{key}[#{inner_key}]=#{inner_value}"
|
198
|
-
end
|
199
|
-
when Array
|
200
|
-
value.map { |inner_value| "#{key}[]=#{inner_value}" }
|
201
|
-
else
|
202
|
-
"#{key}=#{value}"
|
203
|
-
end
|
204
|
-
end
|
239
|
+
# Returns the request Hash.
|
240
|
+
def options(endpoint)
|
241
|
+
do_request :options, add_query_params(endpoint, nil)
|
205
242
|
end
|
206
243
|
end
|
207
244
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
5
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
6
5
|
# Version is loaded directly to avoid circular requires
|
7
6
|
require_relative "lib/woocommerce_api/version"
|
@@ -9,7 +8,6 @@ require_relative "lib/woocommerce_api/version"
|
|
9
8
|
Gem::Specification.new do |s|
|
10
9
|
s.name = "woocommerce-ruby3-api"
|
11
10
|
s.version = WooCommerce::VERSION
|
12
|
-
s.date = "2025-10-04"
|
13
11
|
|
14
12
|
s.summary = "A Ruby 3+ wrapper for the WooCommerce API"
|
15
13
|
s.description = "This gem provides a wrapper to access the WooCommerce REST API, optimized for Ruby 3+"
|
@@ -17,7 +15,7 @@ Gem::Specification.new do |s|
|
|
17
15
|
|
18
16
|
s.authors = ["Claudio Sanches", "Benjamin Randles-Dunkley"]
|
19
17
|
s.email = "ben@chemica.co.uk"
|
20
|
-
|
18
|
+
|
21
19
|
# Files included in the gem
|
22
20
|
s.files = Dir[
|
23
21
|
"lib/**/*.rb",
|
@@ -26,20 +24,18 @@ Gem::Specification.new do |s|
|
|
26
24
|
"*.gemspec"
|
27
25
|
]
|
28
26
|
s.require_paths = ["lib"]
|
29
|
-
|
30
|
-
s.homepage
|
27
|
+
|
28
|
+
s.homepage = "https://github.com/chemica/woocommerce-ruby3-api"
|
31
29
|
s.required_ruby_version = ">= 3.1.0"
|
32
30
|
|
33
31
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
-
s.extra_rdoc_files =
|
32
|
+
s.extra_rdoc_files = ["README.md", "LICENSE"]
|
35
33
|
|
34
|
+
s.add_runtime_dependency "addressable", "~> 2.8.1"
|
35
|
+
s.add_runtime_dependency "base64", "~> 0.2.0"
|
36
36
|
s.add_runtime_dependency "httparty", "~> 0.23.1"
|
37
37
|
s.add_runtime_dependency "json", "~> 2.10.2", ">= 2.6.0"
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
s.add_development_dependency "rake", "~> 13.2.1"
|
42
|
-
s.add_development_dependency "minitest", "~> 5.25.5"
|
43
|
-
s.add_development_dependency "webmock", "~> 3.25.1"
|
44
|
-
s.add_development_dependency "bundler-audit", "~> 0.9.1"
|
38
|
+
|
39
|
+
# Security measures
|
40
|
+
s.metadata["rubygems_mfa_required"] = "true"
|
45
41
|
end
|
metadata
CHANGED
@@ -1,49 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woocommerce-ruby3-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Sanches
|
8
8
|
- Benjamin Randles-Dunkley
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.23.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.23.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
14
|
+
name: addressable
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 2.6.0
|
19
|
+
version: 2.8.1
|
37
20
|
type: :runtime
|
38
21
|
prerelease: false
|
39
22
|
version_requirements: !ruby/object:Gem::Requirement
|
40
23
|
requirements:
|
41
24
|
- - "~>"
|
42
25
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 2.6.0
|
26
|
+
version: 2.8.1
|
47
27
|
- !ruby/object:Gem::Dependency
|
48
28
|
name: base64
|
49
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,75 +39,39 @@ dependencies:
|
|
59
39
|
- !ruby/object:Gem::Version
|
60
40
|
version: 0.2.0
|
61
41
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
42
|
+
name: httparty
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
64
44
|
requirements:
|
65
45
|
- - "~>"
|
66
46
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
47
|
+
version: 0.23.1
|
68
48
|
type: :runtime
|
69
49
|
prerelease: false
|
70
50
|
version_requirements: !ruby/object:Gem::Requirement
|
71
51
|
requirements:
|
72
52
|
- - "~>"
|
73
53
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rake
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: 13.2.1
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 13.2.1
|
54
|
+
version: 0.23.1
|
89
55
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
56
|
+
name: json
|
91
57
|
requirement: !ruby/object:Gem::Requirement
|
92
58
|
requirements:
|
93
59
|
- - "~>"
|
94
60
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
96
|
-
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 5.25.5
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: webmock
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
61
|
+
version: 2.10.2
|
62
|
+
- - ">="
|
108
63
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
110
|
-
type: :
|
64
|
+
version: 2.6.0
|
65
|
+
type: :runtime
|
111
66
|
prerelease: false
|
112
67
|
version_requirements: !ruby/object:Gem::Requirement
|
113
68
|
requirements:
|
114
69
|
- - "~>"
|
115
70
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
117
|
-
-
|
118
|
-
name: bundler-audit
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 0.9.1
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
71
|
+
version: 2.10.2
|
72
|
+
- - ">="
|
129
73
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
74
|
+
version: 2.6.0
|
131
75
|
description: This gem provides a wrapper to access the WooCommerce REST API, optimized
|
132
76
|
for Ruby 3+
|
133
77
|
email: ben@chemica.co.uk
|
@@ -147,7 +91,8 @@ files:
|
|
147
91
|
homepage: https://github.com/chemica/woocommerce-ruby3-api
|
148
92
|
licenses:
|
149
93
|
- MIT
|
150
|
-
metadata:
|
94
|
+
metadata:
|
95
|
+
rubygems_mfa_required: 'true'
|
151
96
|
rdoc_options:
|
152
97
|
- "--charset=UTF-8"
|
153
98
|
require_paths:
|