Class: Linzer::Message::Adapter::Rack::Response

Inherits:
Abstract
  • Object
show all
Includes:
Common
Defined in:
lib/linzer/message/adapter/rack/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.



10
11
12
13
14
15
16
17
# File 'lib/linzer/message/adapter/rack/response.rb', line 10

def initialize(operation, **options)
  @operation = operation
  validate
  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



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

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

#headersObject



19
20
21
# File 'lib/linzer/message/adapter/rack/response.rb', line 19

def headers
  @operation.headers
end