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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 894dc87ae40a0e2cda7aa5a68524b92406fa250a89bddd8ad3263272d854566b
4
- data.tar.gz: c4c8b4196573df4db0be64a481df4800e7379522b656f7962f60d0691dd27ee8
3
+ metadata.gz: 502680751797b4799c3e5f5d19fa0e954bd5a27eaf1b4b755766a388e6c3f70a
4
+ data.tar.gz: 4640aa3ce4043533a8d34869922b2bad44f7e398575466d6e00d757710dd57b4
5
5
  SHA512:
6
- metadata.gz: e129621bf469ccea5c0d50c82a87aaec21db69ba81c2f27d832a7ce49f3fe3f245039968e3d4c094fdb0a1b713a351132d4ca94f245e312c1cf9e19a380a279b
7
- data.tar.gz: ce7a731bb2e05e7cc8bf8d203d3266a96bd3430d04ef4e4f031211f89f17eb6c8912745717e35585b404c7d5d2544e989ef4128fd6a5439fb4b4af786034ae00
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 ? @param_value : name
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].nil?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Purple
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.9.2"
5
5
  end
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-09 00:00:00.000000000 Z
11
+ date: 2025-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer