Skip to content

Commit 6b413a6

Browse files
committed
use addressable gem to encode uri params to get ruby 3 ready
1 parent 302438b commit 6b413a6

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
source "https://rubygems.org"
22

3+
gem "addressable"
34
gem "httparty"
45
gem "json"
56

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4+
addressable (2.8.1)
5+
public_suffix (>= 2.0.2, < 6.0)
46
fakeweb (1.3.0)
57
httparty (0.21.0)
68
mini_mime (>= 1.0.0)
@@ -9,12 +11,14 @@ GEM
911
mini_mime (1.1.2)
1012
minitest (5.17.0)
1113
multi_xml (0.6.0)
14+
public_suffix (5.0.1)
1215
rake (13.0.6)
1316

1417
PLATFORMS
1518
ruby
1619

1720
DEPENDENCIES
21+
addressable
1822
fakeweb
1923
httparty
2024
json

lib/woocommerce_api.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require "addressable/uri"
12
require "httparty"
23
require "json"
34

@@ -97,7 +98,7 @@ def add_query_params endpoint, data
9798

9899
endpoint += "?" unless endpoint.include? "?"
99100
endpoint += "&" unless endpoint.end_with? "?"
100-
endpoint + URI.encode(flatten_hash(data).join("&"))
101+
endpoint + Addressable::URI.encode(flatten_hash(data).join("&"))
101102
end
102103

103104
# Internal: Get URL for requests

woocommerce_api.gemspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ require "woocommerce_api/version"
88
Gem::Specification.new do |s|
99
s.name = "woocommerce_api"
1010
s.version = WooCommerce::VERSION
11-
s.date = "2016-12-14"
11+
s.date = "2023-02-08"
1212

1313
s.summary = "A Ruby wrapper for the WooCommerce API"
14-
s.description = "This gem provide a wrapper to deal with the WooCommerce REST API"
14+
s.description = "This gem provide a wrapper to deal with the WooCommerce REST API. It was forked to provide ruby 3 compatibility"
1515
s.license = "MIT"
1616

17-
s.authors = ["Claudio Sanches"]
18-
s.email = "claudio@automattic.com"
17+
s.authors = ["Claudio Sanches", "Steve Reinke"]
1918
s.files = Dir["lib/woocommerce_api.rb", "lib/woocommerce_api/*.rb"]
20-
s.homepage = "https://github.com/woocommerce/wc-api-ruby"
19+
s.homepage = "https://github.com/stevereinke/wc-api-ruby"
2120

2221
s.rdoc_options = ["--charset=UTF-8"]
2322
s.extra_rdoc_files = %w[README.md LICENSE]
2423

24+
s.add_runtime_dependency "addressable", ">= 2.8.1"
2525
s.add_runtime_dependency "httparty", "~> 0.14", ">= 0.14.0"
2626
s.add_runtime_dependency "json", "~> 2.0", ">= 2.0.0"
2727
end

0 commit comments

Comments
 (0)