purple-client 0.1.9 → 0.1.9.2
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/path.rb +7 -1
- data/lib/purple/responses/body.rb +4 -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: 502680751797b4799c3e5f5d19fa0e954bd5a27eaf1b4b755766a388e6c3f70a
|
4
|
+
data.tar.gz: 4640aa3ce4043533a8d34869922b2bad44f7e398575466d6e00d757710dd57b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f15b0a14ce71d8d510a21580cc7e168537b49f268f8c580f02befe92b764f1fb1ccc844cb825db5f6e42ed2dbc0647c368252394b32efa70cf3565bdecbc45ec
|
7
|
+
data.tar.gz: 24f8df9b9b90192a697ecf94da2f7517bff6e72e0ae16dc4055af1eef9eda5f5aab55083a1aaa24f949cab90e9de90769fa69469cd7a2ce66d8aedbaeff7d9df
|
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
|
|
@@ -82,6 +82,8 @@ class Purple::Responses::Body
|
|
82
82
|
next if value[:optional]
|
83
83
|
next if value[:allow_blank] && object[key].blank?
|
84
84
|
|
85
|
+
raise BodyStructureMismatchError.new(key, value[:type], object[key], object) if object[key].is_a?(Array)
|
86
|
+
|
85
87
|
check_type!(object, key, value[:type])
|
86
88
|
else
|
87
89
|
next if object[key].nil?
|
@@ -89,9 +91,9 @@ class Purple::Responses::Body
|
|
89
91
|
check_structure!(object[key], substructure[key])
|
90
92
|
end
|
91
93
|
elsif value.is_a?(Array)
|
92
|
-
if object[key].
|
94
|
+
if object[key].blank?
|
93
95
|
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."
|
96
|
+
"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
97
|
end
|
96
98
|
|
97
99
|
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.9
|
4
|
+
version: 0.1.9.2
|
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
|