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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 881185e578b5ac0cc7befe360c066912d3968618812133654d56c3db3f389e79
4
- data.tar.gz: e379ba148da036fba958912c8079873a22bbfebf71faf0aec76560a0dd56e8f8
3
+ metadata.gz: 5c4c603507ce363b8817c12e4764d6999b7217f01326d3b0611cf59b86ee8e11
4
+ data.tar.gz: 1ec03d3ed101cd31e16180973b114e18ba103bd33fd69ce6dd6b5f071fec9444
5
5
  SHA512:
6
- metadata.gz: e67d20be2d1f5179b2045cbe80b1d5fc209c873c21537f0cc362fd2fcadbe6f87ede8e4000c3b1d43eaae4675c6d36074f8288b29cf56537d34affbdfdf01a08
7
- data.tar.gz: 6267243d74dc3ceb5775cba2a9388b441b8abad34b2f068318f5a6e79d1f387cc6231f105b51853ab9800cdc2c2574dacd0eb0bdc4cda2bc98ba4bb10d67abd6
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
- [![Gem Version](https://badge.fury.io/rb/woocommerce-ruby3-api.svg?bust=1)](https://badge.fury.io/rb/woocommerce-ruby3-api)
5
+ [![Gem Version](https://badge.fury.io/rb/woocommerce-ruby3-api.svg?bust=3)](https://badge.fury.io/rb/woocommerce-ruby3-api)
6
6
  [![Tests](https://github.com/chemica/woocommerce-ruby3-api/actions/workflows/test.yml/badge.svg?branch=main&bust=1)](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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WooCommerce
4
- VERSION = "1.5.2"
4
+ VERSION = "1.5.3"
5
5
  end
@@ -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
- version: "v3",
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: woocommerce-ruby3-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Sanches