Class: Soren::Response

Inherits:
Object show all
Defined in:
lib/soren/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(parsed_response) ⇒ Response

: (Hash[Symbol, untyped]) -> void



38
39
40
41
42
43
44
45
46
# File 'lib/soren/response.rb', line 38

def initialize(parsed_response)
  parsed_status_line = parsed_response[:status_line]
  @version = parsed_status_line[:version] #: Soren::Types::Response::Version
  @code = parsed_status_line[:code] #: Soren::Types::Response::Code
  @message = parsed_status_line[:message] #: Soren::Types::Response::Message

  @headers = parsed_response[:headers] #: Soren::Types::Response::Headers
  @body = parsed_response[:body] #: Soren::Types::Response::Body
end

Instance Method Details

#bodyObject

: -> String



33
34
35
# File 'lib/soren/response.rb', line 33

def body
  @body.to_s
end

#codeObject

: -> Integer



13
14
15
# File 'lib/soren/response.rb', line 13

def code
  @code.to_i
end

#headersObject

: -> Hash[String, Array]



28
29
30
# File 'lib/soren/response.rb', line 28

def headers
  @headers.to_h
end

#messageObject

: -> String



18
19
20
# File 'lib/soren/response.rb', line 18

def message
  @message.to_s
end

#versionObject

: -> String



23
24
25
# File 'lib/soren/response.rb', line 23

def version
  @version.to_s
end