flexirest 1.12.1 → 1.12.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/.github/workflows/build.yml +2 -2
- data/CHANGELOG.md +12 -0
- data/lib/flexirest/request.rb +4 -2
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/configuration_spec.rb +0 -24
- data/spec/lib/request_spec.rb +26 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61eaaa77dfcbab57b714007844456fe903c759cbb981761a43b7eb4910da3463
|
4
|
+
data.tar.gz: 10e7bbe8cc3b35887eb34c32562af637ed8cd4aae34df0547c2e2cd52a730a7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 251b2a247480a4f7b3c46a70cd469c3ad24cbdb6c245703ec60658ae3429107a7a364eb12e8794c2e28729ebb58e7a17bc1d2fbeebf59a035d5f277032ba7d82
|
7
|
+
data.tar.gz: e4fb534d1775963465155761cd4e6b8a7f14e7c66b0f0406d48d39abe4810906c588a9f00fea1b9325b1ed6d1682c9224f47b07c0f75e51b48986d2be43f5e0c
|
data/.github/workflows/build.yml
CHANGED
@@ -19,10 +19,10 @@ jobs:
|
|
19
19
|
runs-on: ubuntu-latest
|
20
20
|
strategy:
|
21
21
|
matrix:
|
22
|
-
ruby-version: ['3.0', '3.1', '3.2']
|
22
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3']
|
23
23
|
|
24
24
|
steps:
|
25
|
-
- uses: actions/checkout@
|
25
|
+
- uses: actions/checkout@v4
|
26
26
|
- name: Set up Ruby
|
27
27
|
uses: ruby/setup-ruby@v1
|
28
28
|
with:
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.12.3
|
4
|
+
|
5
|
+
Bugfix:
|
6
|
+
|
7
|
+
- Do not raise undefined method error when ignore_root value is null (thanks to jpawlyn for the PR)
|
8
|
+
|
9
|
+
## 1.12.2
|
10
|
+
|
11
|
+
Bugfix:
|
12
|
+
|
13
|
+
- Changing the parameters in a `defaults` option to a mapping shouldn't mutate the parameters, meaning that retries should get the same as the original parameters (thanks to vskbjrn for the bug report)
|
14
|
+
|
3
15
|
## 1.12.1
|
4
16
|
|
5
17
|
Bugfix:
|
data/lib/flexirest/request.rb
CHANGED
@@ -344,6 +344,8 @@ module Flexirest
|
|
344
344
|
params = {id:params}
|
345
345
|
end
|
346
346
|
|
347
|
+
params = params.dup
|
348
|
+
|
347
349
|
# Format includes parameter for jsonapi
|
348
350
|
if proxy == :json_api
|
349
351
|
JsonAPIProxy::Request::Params.translate(params, @object._include_associations)
|
@@ -878,14 +880,14 @@ module Flexirest
|
|
878
880
|
|
879
881
|
if ignore_root
|
880
882
|
[ignore_root].flatten.each do |key|
|
881
|
-
body = body[key.to_s] if body.has_key?(key.to_s)
|
883
|
+
body = body[key.to_s] || {} if body.has_key?(key.to_s)
|
882
884
|
end
|
883
885
|
end
|
884
886
|
elsif is_xml_response?
|
885
887
|
body = @response.body.blank? ? {} : Crack::XML.parse(@response.body)
|
886
888
|
if ignore_root
|
887
889
|
[ignore_root].flatten.each do |key|
|
888
|
-
body = body[key.to_s] if body.has_key?(key.to_s)
|
890
|
+
body = body[key.to_s] || {} if body.has_key?(key.to_s)
|
889
891
|
end
|
890
892
|
elsif options[:ignore_xml_root]
|
891
893
|
Flexirest::Logger.warn("Using `ignore_xml_root` is deprecated, please switch to `ignore_root`")
|
data/lib/flexirest/version.rb
CHANGED
@@ -81,18 +81,6 @@ describe Flexirest::Configuration do
|
|
81
81
|
expect(SubConfigurationExample.username).to eq("john")
|
82
82
|
end
|
83
83
|
|
84
|
-
it "should escape the username" do
|
85
|
-
Flexirest::Base.username = "bill@example.com"
|
86
|
-
expect(Flexirest::Base.username).to eq("bill%40example.com")
|
87
|
-
Flexirest::Base.username = nil
|
88
|
-
end
|
89
|
-
|
90
|
-
it "should not doubly escape the username" do
|
91
|
-
Flexirest::Base.username = "bill%40example.com"
|
92
|
-
expect(Flexirest::Base.username).to_not eq("bill%2540example.com")
|
93
|
-
Flexirest::Base.username = nil
|
94
|
-
end
|
95
|
-
|
96
84
|
it "should remember the set password" do
|
97
85
|
expect(ConfigurationExample.password).to eq("smith")
|
98
86
|
end
|
@@ -107,18 +95,6 @@ describe Flexirest::Configuration do
|
|
107
95
|
expect(SubConfigurationExample.password).to eq("smith")
|
108
96
|
end
|
109
97
|
|
110
|
-
it "should escape the password" do
|
111
|
-
Flexirest::Base.password = "something@else"
|
112
|
-
expect(Flexirest::Base.password).to eq("something%40else")
|
113
|
-
Flexirest::Base.password = nil
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should not doubly escape the password" do
|
117
|
-
Flexirest::Base.password = "something%40else"
|
118
|
-
expect(Flexirest::Base.password).to_not eq("something%2540else")
|
119
|
-
Flexirest::Base.password = nil
|
120
|
-
end
|
121
|
-
|
122
98
|
it "should default to a form_encoded request_body_type" do
|
123
99
|
expect(Flexirest::Base.request_body_type).to eq(:form_encoded)
|
124
100
|
end
|
data/spec/lib/request_spec.rb
CHANGED
@@ -173,6 +173,13 @@ describe Flexirest::Request do
|
|
173
173
|
get :second_call, "/second_call"
|
174
174
|
end
|
175
175
|
|
176
|
+
class SimpleRetryingExampleClient < Flexirest::Base
|
177
|
+
base_url "http://www.example.com"
|
178
|
+
get :all, "/objects", defaults: proc { |params| { type: params.delete(:object_type) } }
|
179
|
+
|
180
|
+
after_request -> (name, response) { raise Flexirest::CallbackRetryRequestException.new }
|
181
|
+
end
|
182
|
+
|
176
183
|
class LazyLoadedExampleClient < ExampleClient
|
177
184
|
base_url "http://www.example.com"
|
178
185
|
lazy_load!
|
@@ -214,6 +221,14 @@ describe Flexirest::Request do
|
|
214
221
|
}
|
215
222
|
end
|
216
223
|
|
224
|
+
class IgnoredRootWithNullValueExampleClient < ExampleClient
|
225
|
+
get :root, "/root", ignore_root: "feed", fake: %Q{
|
226
|
+
{
|
227
|
+
"feed": null
|
228
|
+
}
|
229
|
+
}
|
230
|
+
end
|
231
|
+
|
217
232
|
class IgnoredRootWithUnexpectedResponseExampleClient < ExampleClient
|
218
233
|
get :root, "/root", ignore_root: "feed", fake: %Q{
|
219
234
|
{
|
@@ -1395,6 +1410,13 @@ describe Flexirest::Request do
|
|
1395
1410
|
expect(RetryingExampleClient.retries).to eq(2)
|
1396
1411
|
end
|
1397
1412
|
|
1413
|
+
it "shouldn't destructively change params before retrying" do
|
1414
|
+
stub_request(:get, "http://www.example.com/objects?type=foo").
|
1415
|
+
to_return(status: 200, body: "", headers: {})
|
1416
|
+
SimpleRetryingExampleClient.all(object_type: 'foo')
|
1417
|
+
|
1418
|
+
expect(WebMock).to have_requested(:get, "www.example.com/objects?type=foo").twice
|
1419
|
+
end
|
1398
1420
|
|
1399
1421
|
context "Direct URL requests" do
|
1400
1422
|
class SameServerExampleClient < Flexirest::Base
|
@@ -1573,6 +1595,10 @@ describe Flexirest::Request do
|
|
1573
1595
|
expect(IgnoredRootExampleClient.root.title).to eq("Example Feed")
|
1574
1596
|
end
|
1575
1597
|
|
1598
|
+
it "should not raise an error if ignore_root value is null" do
|
1599
|
+
expect(IgnoredRootWithNullValueExampleClient.root).to be_instance_of(IgnoredRootWithNullValueExampleClient)
|
1600
|
+
end
|
1601
|
+
|
1576
1602
|
it "should ignore an ignore_root parameter if the specified element is not in the response" do
|
1577
1603
|
expect(IgnoredRootWithUnexpectedResponseExampleClient.root.error.message).to eq("Example Error")
|
1578
1604
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexirest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -407,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
407
407
|
- !ruby/object:Gem::Version
|
408
408
|
version: '0'
|
409
409
|
requirements: []
|
410
|
-
rubygems_version: 3.
|
410
|
+
rubygems_version: 3.5.6
|
411
411
|
signing_key:
|
412
412
|
specification_version: 4
|
413
413
|
summary: This gem is for accessing REST services in a flexible way. ActiveResource
|