Class: Angus::Remote::RemoteResponse

Inherits:
Object
  • Object
show all
Includes:
Angus::Remote::Response::Hash
Defined in:
lib/angus/remote/remote_response.rb

Overview

A service’s response

Acts as an array to store information at HTTP level, like the status_code

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Angus::Remote::Response::Hash

#elements

Constructor Details

#initializeRemoteResponse

Returns a new instance of RemoteResponse.



16
17
18
# File 'lib/angus/remote/remote_response.rb', line 16

def initialize
  @http_response_info = {}
end

Instance Attribute Details

#messagesObject

Returns the value of attribute messages.



14
15
16
# File 'lib/angus/remote/remote_response.rb', line 14

def messages
  @messages
end

#statusObject

Returns the value of attribute status.



12
13
14
# File 'lib/angus/remote/remote_response.rb', line 12

def status
  @status
end

#status_codeObject

Returns the value of attribute status_code.



13
14
15
# File 'lib/angus/remote/remote_response.rb', line 13

def status_code
  @status_code
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
# File 'lib/angus/remote/remote_response.rb', line 24

def [](key)
  @http_response_info[key]
end

#[]=(key, value) ⇒ Object



20
21
22
# File 'lib/angus/remote/remote_response.rb', line 20

def []=(key, value)
  @http_response_info[key] = value
end

#to_hashObject



32
33
34
35
36
37
38
39
# File 'lib/angus/remote/remote_response.rb', line 32

def to_hash
  {
    :http_status_code => @http_response_info[:status_code],
    :body => @http_response_info[:body],
    :service_name => @http_response_info[:service_name],
    :operation_name => @http_response_info[:operation_name],
  }
end

#to_sObject



28
29
30
# File 'lib/angus/remote/remote_response.rb', line 28

def to_s
  "#<#{self.class}:#{object_id}>"
end