Class: Linzer::Message::Adapter::HTTPGem::Response

Inherits:
Abstract
  • Object
show all
Defined in:
lib/linzer/message/adapter/http_gem/response.rb

Instance Method Summary collapse

Methods inherited from Abstract

#attached_request?, #field?, #request?, #response?

Constructor Details

#initialize(operation, **options) ⇒ Response

Returns a new instance of Response.



12
13
14
15
# File 'lib/linzer/message/adapter/http_gem/response.rb', line 12

def initialize(operation, **options)
  @operation = operation
  freeze
end

Instance Method Details

#[](field_name) ⇒ Object

XXX: this implementation is incomplete, e.g.: ;tr parameter is not supported yet



22
23
24
25
# File 'lib/linzer/message/adapter/http_gem/response.rb', line 22

def [](field_name)
  return @operation.code if field_name == "@status"
  @operation[field_name]
end

#attach!(signature) ⇒ Object



27
28
29
30
# File 'lib/linzer/message/adapter/http_gem/response.rb', line 27

def attach!(signature)
  signature.to_h.each { |h, v| @operation[h] = v }
  @operation
end

#header(name) ⇒ Object



17
18
19
# File 'lib/linzer/message/adapter/http_gem/response.rb', line 17

def header(name)
  @operation[name]
end