lib/never_bounce/api/session.rb
def robj_klass_and_attrs
      @robj_klass_and_attrs ||= begin
        if (h = robj_hash_preview).is_a? Hash
          # Determine response class based on API convention.
          begin
            [
              h.fetch("status") == "success" ? request.class.response_klass : Response::ErrorMessage,
              body_hash: robj_hash_preview,
            ]
          rescue KeyError
            raise FormatError, "Key 'status' not found: #{h.inspect}"
          end
        elsif robj_hash_preview == false
          # Let response class handle it on its own.
          [
            request.class.response_klass,
            raw: server_raw,
          ]
        else
          raise AttributeError, "Unknown `robj_hash_preview`: #{robj_hash_preview.inspect}"
        end
      end
    end
# Render response object class and constructor attributes based on peeking in the data.
# @!attribute robj_klass_and_attrs
# @return [Array<Class,Hash>]
Render response object class and constructor attributes based on peeking in the data.
Render response object class and constructor attributes based on peeking in the data .
def robj_klass_and_attrs
      @robj_klass_and_attrs ||= begin
        if (h = robj_hash_preview).is_a? Hash
          begin
            [
              h.fetch("status") == "success" ? request.class.response_klass : Response::ErrorMessage,
              body_hash: robj_hash_preview,
            ]
          rescue KeyError
            raise FormatError, "Key 'status' not found: #{h.inspect}"
          end
        elsif robj_hash_preview == false
          [
            request.class.response_klass,
            raw: server_raw,
          ]
        else
          raise AttributeError, "Unknown `robj_hash_preview`: #{robj_hash_preview.inspect}"
        end
      end
    end
def robj_klass_and_attrs @robj_klass_and_attrs ||= begin if ( h = robj_hash_preview ) . is_a? Hash begin [ h . fetch ( "status" ) == "success" ? request . class . response_klass : Response :: ErrorMessage , body_hash : robj_hash_preview , ] rescue KeyError raise FormatError , "Key 'status' not found: #{h.inspect}" end elsif robj_hash_preview == false [ request . class . response_klass , raw : server_raw , ] else raise AttributeError , "Unknown `robj_hash_preview`: #{robj_hash_preview.inspect}" end end end
Render response object class and constructor attributes based on peeking in the data.
Render response object class and constructor attributes based on peeking in the data .
# Determine response class based on API convention. # Let response class handle it on its own.
None
Array<Class,Hash>
!attribute
None