lib/daylight/errors.rb
##
# Sets the error messages when there is a payload on the response and a format that is handled
# Saves the request_id of the error if available.
#--
# "application/xml; charset=utf-8"
# "application/json; charset=utf-8"
Sets the error messages when there is a payload on the response and a format that is handled
Saves the request_id of the error if available.

"application/xml; charset=utf-8"
"application/json; charset=utf-8"
Sets the error messages when there is a payload on the response and a format that is handled Saves the request_id of the error if available . " application / xml ; charset = utf - 8 " " application / json ; charset = utf - 8 "
def parse response
        @request_id = response.header['x-request-id']
        _, subtype = CONTENT_TYPE_FORMAT.match(response.header['content-type']).captures rescue nil
        return unless subtype.present? && response.body.present?
        @messages =
          case subtype
            when  'xml'; self.class.from_xml(response.body)
            when 'json'; self.class.from_json(response.body)
            else
              []
          end
      end
def parse response @request_id = response . header [ 'x-request-id' ] _ , subtype = CONTENT_TYPE_FORMAT . match ( response . header [ 'content-type' ] ) . captures rescue nil return unless subtype . present? && response . body . present? @messages = case subtype when 'xml' ; self . class . from_xml ( response . body ) when 'json' ; self . class . from_json ( response . body ) else [ ] end end
Sets the error messages when there is a payload on the response and a format that is handled
Saves the request_id of the error if available.
Sets the error messages when there is a payload on the response and a format that is handled Saves the request_id of the error if available .
response
<not_specific>