purple-client 0.1.8 → 0.1.9.1
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/lib/purple/client.rb +8 -0
- data/lib/purple/path.rb +8 -1
- data/lib/purple/responses/body.rb +2 -2
- data/lib/purple/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 449c3507b473362c91ae54c9ba05261ee47f8954ee6029bbadea455665bdfc6d
|
4
|
+
data.tar.gz: 1f05c3273df179762325965927e7a4168d92178e71ab90d33a2ec322e43841ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25448d731921229e6cc6843a16da6701ef28d6c2f5ae251a8ac78df5c363af6b6824b247b2b75f55d6fffe72cc87ac9fa3f3157bb2444ebbcda0a6d8d26d3bf3
|
7
|
+
data.tar.gz: 64bcf742dc5d6d7694cb0eb58c65891943bbfe3a1d69d2070cbcfccaf52cb8dcb6d169df81ed618311e07b61c006d1430fcc5719876bef35d0700416186d5a85
|
data/lib/purple/client.rb
CHANGED
data/lib/purple/path.rb
CHANGED
@@ -5,6 +5,7 @@ require 'faraday'
|
|
5
5
|
require 'active_support/core_ext/hash/deep_merge'
|
6
6
|
require 'active_support/core_ext/object/inclusion'
|
7
7
|
require 'active_support/core_ext/object/blank'
|
8
|
+
require 'cgi'
|
8
9
|
|
9
10
|
module Purple
|
10
11
|
class Path
|
@@ -20,7 +21,12 @@ module Purple
|
|
20
21
|
option :responses, optional: true, default: -> { [] }
|
21
22
|
|
22
23
|
def full_path
|
23
|
-
current_path = is_param
|
24
|
+
current_path = if is_param
|
25
|
+
CGI.escape(@param_value.to_s)
|
26
|
+
else
|
27
|
+
name
|
28
|
+
end
|
29
|
+
|
24
30
|
parent.nil? ? current_path : "#{parent.full_path}/#{current_path}"
|
25
31
|
end
|
26
32
|
|
@@ -64,6 +70,7 @@ module Purple
|
|
64
70
|
end
|
65
71
|
|
66
72
|
connection = Faraday.new(url: client.domain) do |conn|
|
73
|
+
conn.options.timeout = client.timeout if client.timeout.present?
|
67
74
|
conn.headers = headers
|
68
75
|
end
|
69
76
|
|
@@ -89,9 +89,9 @@ class Purple::Responses::Body
|
|
89
89
|
check_structure!(object[key], substructure[key])
|
90
90
|
end
|
91
91
|
elsif value.is_a?(Array)
|
92
|
-
if object[key].
|
92
|
+
if object[key].blank?
|
93
93
|
raise BodyStructureMismatchError.new(key, value, nil, object),
|
94
|
-
"Expected a non-nil array for '#{key}' in response body.\n\nExpected response structure: #{substructure}.\n\nUse '#{key}: { type: #{value}, allow_blank: true }' if this field can be nil."
|
94
|
+
"Expected a non-nil array for '#{key}' in response body.\n\nExpected response structure: #{substructure}.\n\nUse '#{key}: { type: #{value}, allow_blank: true }' if this field can be nil, blank or empty."
|
95
95
|
end
|
96
96
|
|
97
97
|
type = value.first
|
data/lib/purple/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purple-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-initializer
|