Class: Linzer::Message::Adapter::Generic::Response

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

Direct Known Subclasses

HTTPGem::Response, NetHTTP::Response

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.



8
9
10
11
12
13
14
# File 'lib/linzer/message/adapter/generic/response.rb', line 8

def initialize(operation, **options)
  @operation = operation
  attached_request = options[:attached_request]
  @attached_request = attached_request ? Message.new(attached_request) : nil
  validate_attached_request @attached_request if @attached_request
  freeze
end

Instance Method Details

#attach!(signature) ⇒ Object



20
21
22
23
# File 'lib/linzer/message/adapter/generic/response.rb', line 20

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

#header(name) ⇒ Object



16
17
18
# File 'lib/linzer/message/adapter/generic/response.rb', line 16

def header(name)
  @operation[name]
end