Skip to content

Commit 0b5af93

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

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
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

0 commit comments

Comments
 (0)