Method: CoreLibrary::ResponseHandler#apply_deserializer
- Defined in:
- lib/apimatic-core/response_handler.rb
#apply_deserializer(response, should_symbolize_hash) ⇒ Object
Applies deserializer to the response.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/apimatic-core/response_handler.rb', line 202 def apply_deserializer(response, should_symbolize_hash) return if @is_nullable_response && (response.raw_body.nil? || response.raw_body.to_s.strip.empty?) return apply_xml_deserializer(response) if @is_xml_response return response.raw_body if @deserializer.nil? if @datetime_format @deserializer.call(response.raw_body, @datetime_format, @is_response_array, should_symbolize_hash) elsif @is_date_response @deserializer.call(response.raw_body, @is_response_array, should_symbolize_hash) elsif !@deserialize_into.nil? || @is_primitive_response @deserializer.call(response.raw_body, @deserialize_into, @is_response_array, should_symbolize_hash) else @deserializer.call(response.raw_body, should_symbolize_hash) end end |