Sha256: ec7ed3bf6b7deac497e65d87c902917dbaba3f4eb9afa51f997b477f4bd2df16

Contents?: true

Size: 809 Bytes

Versions: 13

Compression:

Stored size: 809 Bytes

Contents

module Unimatrix::Authorization

  class Response < Unimatrix::Response

    attr_reader :code
    attr_reader :body
    attr_reader :resources

    def initialize( http_response, path = "" )
      @request_path   = path
      @success        = http_response.is_a?( Net::HTTPOK )
      @code           = http_response.code
      @resources      = []
      @body           = decode_response_body( http_response )

      if ( @body && @body.respond_to?( :keys ) )
        Parser.new( @body, @request_path ) do | parser |
          @resources = parser.resources
          @success   = !( parser.type_name == 'error' )
        end
      else
        @success  = false
        @resources << Unimatrix::Error.new(
          message: "#{ @code }: #{ http_response.message }."
        )
      end
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
unimatrix-3.4.0 lib/unimatrix/authorization/response.rb
unimatrix-3.3.4 lib/unimatrix/authorization/response.rb
unimatrix-3.3.3 lib/unimatrix/authorization/response.rb
unimatrix-3.3.2 lib/unimatrix/authorization/response.rb
unimatrix-3.3.1 lib/unimatrix/authorization/response.rb
unimatrix-3.3.0 lib/unimatrix/authorization/response.rb
unimatrix-3.2.0 lib/unimatrix/authorization/response.rb
unimatrix-3.1.0 lib/unimatrix/authorization/response.rb
unimatrix-3.0.0 lib/unimatrix/authorization/response.rb
unimatrix-2.9.0 lib/unimatrix/authorization/response.rb
unimatrix-2.8.0 lib/unimatrix/authorization/response.rb
unimatrix-2.7.1 lib/unimatrix/authorization/response.rb
unimatrix-2.7.0 lib/unimatrix/authorization/response.rb