apimatic_core 0.3.8 → 0.3.9

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: f2e63e21797c24ebc97dd600ad78da020cda9ef430f54b3d33d4f98c29d6d26d
4
+ data.tar.gz: dcd68bd2a3d9d54d1643120f85be3c6f7edd0299776600693316df9303dd65f8
5
5
  SHA512:
6
- metadata.gz: edbb96486fd7db0982e0d1d43247b839d015c799fc59d6493687d128b5952999f82d5c95752c15dc7aff2829c2f4f5e2a10ae42b882992bb00a5255e41321402
7
- data.tar.gz: cc683617c4117e1fdb58ca1da197af7873ad29b985a3ca7e135ef8db3d54d1113908821877d126fd74d4a1be0d9041942e5142a2dcf70d8223447f010aabb2fc
6
+ metadata.gz: 1c70fcb087fcb9e676e9bb8fe016e055c107e0a6cf08cffa2b36ca378a4221f5478f85b4bd79319976ef4feee078422b23418e2966f36a67b55b82097cf293c8
7
+ data.tar.gz: 01313adab6e529022b84e4c45713800c0e20eb673ff106ea2e6293f055a728ecbac0aa0c955253a355a6c58d6aea86e5075b20b60363d1520bb8fcc37a9560ed
@@ -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.
@@ -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.9
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-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apimatic_core_interfaces