Class: HTTPResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/TeleRuby/http_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, json) ⇒ HTTPResponse

Returns a new instance of HTTPResponse.



7
8
9
10
11
# File 'lib/TeleRuby/http_response.rb', line 7

def initialize(status, json)
  @status = status
  @headers = { 'Content-Type' => 'application/json' }
  @body = [JSON.generate(json)]
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/TeleRuby/http_response.rb', line 5

def body
  @body
end

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'lib/TeleRuby/http_response.rb', line 5

def headers
  @headers
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/TeleRuby/http_response.rb', line 5

def status
  @status
end

Instance Method Details

#to_aObject



13
14
15
# File 'lib/TeleRuby/http_response.rb', line 13

def to_a
  [@status, @headers, @body]
end