woocommerce-ruby3-api 1.5.2 → 1.5.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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/woocommerce_api/version.rb +1 -1
- data/lib/woocommerce_api.rb +15 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c4c603507ce363b8817c12e4764d6999b7217f01326d3b0611cf59b86ee8e11
|
4
|
+
data.tar.gz: 1ec03d3ed101cd31e16180973b114e18ba103bd33fd69ce6dd6b5f071fec9444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fcfe547980697c7a349677631e0d2eea2e871e77b1466d80e7f55f7845119b3281a4464a5e81f795ea9fce69ce96e2ff827704a5ec86e308407527195311a3a
|
7
|
+
data.tar.gz: c0250703cf04ffb2a6ee9af315a97f1c59b89f6f46fa3f8c63c53656f575c42f93dd0fbadb051e9f223eb59ec62485295370ed414d11842e518daa41d5670c1b
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
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
6
|
[](https://github.com/chemica/woocommerce-ruby3-api/actions/workflows/test.yml)
|
7
7
|
|
8
8
|
## About
|
@@ -208,6 +208,7 @@ 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-04-11 - 1.5.3 - Hides sensitive information from ruby "inspect". Prevents accidental exposure in logs or console output.
|
211
212
|
- 2025-04-11 - 1.5.2 - Fixes gemfile.lock issue.
|
212
213
|
- 2025-04-11 - 1.5.1 - Adds RuboCop for code quality. Fixes RuboCop violations. Refactors code and tests for easier maintainability.
|
213
214
|
- 2025-04-10 - 1.5.0 - Update code for Ruby 3.1+ compatibility using Addressable::URI and base64 gem. Add Github CI actions.
|
data/lib/woocommerce_api.rb
CHANGED
@@ -11,15 +11,12 @@ require "woocommerce_api/version"
|
|
11
11
|
module WooCommerce
|
12
12
|
class ApiBase
|
13
13
|
DEFAULT_ARGS = {
|
14
|
-
wp_api: false,
|
15
|
-
|
16
|
-
verify_ssl: true,
|
17
|
-
signature_method: "HMAC-SHA256",
|
18
|
-
httparty_args: {}
|
14
|
+
wp_api: false, version: "v3", verify_ssl: true,
|
15
|
+
signature_method: "HMAC-SHA256", httparty_args: {}
|
19
16
|
}.freeze
|
17
|
+
SENSITIVE_ARGS = [:@consumer_key, :@consumer_secret, :@signature_method].freeze
|
20
18
|
|
21
19
|
def initialize(url, consumer_key, consumer_secret, args = {})
|
22
|
-
# Required args
|
23
20
|
@url = url
|
24
21
|
@consumer_key = consumer_key
|
25
22
|
@consumer_secret = consumer_secret
|
@@ -27,10 +24,21 @@ module WooCommerce
|
|
27
24
|
args = DEFAULT_ARGS.merge(args)
|
28
25
|
create_args_variables(args)
|
29
26
|
|
30
|
-
# Internal args
|
31
27
|
@is_ssl = @url.start_with? "https"
|
32
28
|
end
|
33
29
|
|
30
|
+
# Overrides inspect to hide sensitive information
|
31
|
+
#
|
32
|
+
# Returns a string representation of the object
|
33
|
+
def inspect
|
34
|
+
safe_ivars = instance_variables.each_with_object({}) do |var, hash|
|
35
|
+
value = instance_variable_get(var)
|
36
|
+
hash[var] = SENSITIVE_ARGS.include?(var) ? "[FILTERED]" : value
|
37
|
+
end
|
38
|
+
|
39
|
+
"#<#{self.class}:0x#{object_id.to_s(16)} #{safe_ivars.map { |k, v| "#{k}=#{v.inspect}" }.join(', ')}>"
|
40
|
+
end
|
41
|
+
|
34
42
|
private
|
35
43
|
|
36
44
|
# Internal: Sets authentication options for SSL requests
|