apimatic_core 0.3.8 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c4d7987cd14dba534fc21ecff7af13a00e80d0dc83c87bcdf3ac88f38e74ae4
4
- data.tar.gz: 7c9ad8e1dc5944172bb0fbd8e34d55555f6e9e9292de818000f4d2de9c5ae6b1
3
+ metadata.gz: 911fa8929a894a2fd1d9a899fd87ea6622f5497d931c2e64ebe2a61b5621d512
4
+ data.tar.gz: 5eaeab6524a3b7b02beb0657b2e4b1658f680097ed63b5bad4e7207167a61ad8
5
5
  SHA512:
6
- metadata.gz: edbb96486fd7db0982e0d1d43247b839d015c799fc59d6493687d128b5952999f82d5c95752c15dc7aff2829c2f4f5e2a10ae42b882992bb00a5255e41321402
7
- data.tar.gz: cc683617c4117e1fdb58ca1da197af7873ad29b985a3ca7e135ef8db3d54d1113908821877d126fd74d4a1be0d9041942e5142a2dcf70d8223447f010aabb2fc
6
+ metadata.gz: 9df1330800473fe9caf795f32d61e66a56c3b30647fa24932edd6e74b6428a4d99d512ec239b379a4e68a1bf00e5987c6c255be285b7838a82d4288681e1f809
7
+ data.tar.gz: 53b48921628bc67e93f144a0e44f83edb35136a12a36d1fefc0e7d5f3e259d699fd3f721776e3124cbee8277823defe691f138357615408419a423201a2a655a
@@ -16,6 +16,7 @@ module CoreLibrary
16
16
  @is_date_response = false
17
17
  @is_response_array = false
18
18
  @is_response_void = false
19
+ @is_nullable_response = false
19
20
  end
20
21
 
21
22
  # Sets deserializer for the response.
@@ -138,6 +139,14 @@ module CoreLibrary
138
139
  @is_response_void = is_response_void
139
140
  self
140
141
  end
142
+
143
+ # Sets the is_nullable_response property.
144
+ # @param [Boolean] is_nullable_response Flag to return early in case of empty response payload.
145
+ # @return [ResponseHandler] An updated instance of ResponseHandler.
146
+ def is_nullable_response(is_nullable_response)
147
+ @is_nullable_response = is_nullable_response
148
+ self
149
+ end
141
150
  # rubocop:enable Naming/PredicateName
142
151
 
143
152
  # Main method to handle the response with all the set properties.
@@ -152,7 +161,7 @@ module CoreLibrary
152
161
  # validating response if configured
153
162
  validate(response, global_errors)
154
163
 
155
- return if @is_response_void
164
+ return if @is_response_void && !@is_api_response
156
165
 
157
166
  # applying deserializer if configured
158
167
  deserialized_value = apply_deserializer(response, should_symbolize_hash)
@@ -191,6 +200,8 @@ module CoreLibrary
191
200
  # Applies deserializer to the response.
192
201
  # @param [Boolean] should_symbolize_hash Flag to symbolize the hash during response deserialization.
193
202
  def apply_deserializer(response, should_symbolize_hash)
203
+ return if @is_nullable_response && (response.raw_body.nil? || response.raw_body.to_s.strip.empty?)
204
+
194
205
  return apply_xml_deserializer(response) if @is_xml_response
195
206
  return response.raw_body if @deserializer.nil?
196
207
 
@@ -290,7 +290,7 @@ module CoreLibrary
290
290
  # @return [Hash, Array, nil] The parsed JSON object, or nil if the input string is nil.
291
291
  # @raise [TypeError] if the server responds with invalid JSON and primitive type parsing is not allowed.
292
292
  def self.json_deserialize(json, should_symbolize = false, allow_primitive_type_parsing = false)
293
- return if json.nil?
293
+ return if json.nil? || json.to_s.strip.empty?
294
294
 
295
295
  begin
296
296
  JSON.parse(json, symbolize_names: should_symbolize)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apimatic_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic Ltd.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-21 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces