diff --git a/CHANGELOG.md b/CHANGELOG.md index 44128a4..67dfa41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.1.2 (July 11, 2024) + +- Fix: Don't url-encode parameters to `/oauth` endpoints + # 2.1.1 (April 24, 2024) - Fix: Tell Faraday to use JSON for the request diff --git a/lib/pco/api/endpoint.rb b/lib/pco/api/endpoint.rb index 3ade7a3..87b2a9e 100644 --- a/lib/pco/api/endpoint.rb +++ b/lib/pco/api/endpoint.rb @@ -52,7 +52,7 @@ def get(params = {}) def post(body = {}) @last_result = @connection.post(@url) do |req| - req.body = _build_body(body) + req.body = body.to_json end _build_response(@last_result) rescue Errors::TooManyRequests => e @@ -61,7 +61,7 @@ def post(body = {}) def patch(body = {}) @last_result = @connection.patch(@url) do |req| - req.body = _build_body(body) + req.body = body.to_json end _build_response(@last_result) rescue Errors::TooManyRequests => e @@ -116,18 +116,6 @@ def _build_response(result) end end - def _build_body(body) - if _needs_url_encoded? - Faraday::Utils.build_nested_query(body) - else - body.to_json - end - end - - def _needs_url_encoded? - @url =~ /oauth\/[a-z]+\z/ - end - def _build_endpoint(path) @cache[path] ||= begin self.class.new( diff --git a/lib/pco/api/version.rb b/lib/pco/api/version.rb index b2af64f..13cdfc3 100644 --- a/lib/pco/api/version.rb +++ b/lib/pco/api/version.rb @@ -1,5 +1,5 @@ module PCO module API - VERSION = '2.1.1' + VERSION = '2.1.2' end end