Class: Linzer::Message::Adapter::NetHTTP::Response
- Defined in:
- lib/linzer/message/adapter/net_http/response.rb
Instance Method Summary collapse
-
#[](field_name) ⇒ Object
XXX: this implementation is incomplete, e.g.: ;tr parameter is not supported yet.
- #attach!(signature) ⇒ Object
- #headers ⇒ Object
-
#initialize(operation, **options) ⇒ Response
constructor
A new instance of Response.
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/net_http/response.rb', line 8 def initialize(operation, **) @operation = operation attached_request = [:attached_request] @attached_request = attached_request ? Message.new(attached_request) : nil validate_attached_request @attached_request if @attached_request freeze end |
Instance Method Details
#[](field_name) ⇒ Object
XXX: this implementation is incomplete, e.g.: ;tr parameter is not supported yet
21 22 23 24 |
# File 'lib/linzer/message/adapter/net_http/response.rb', line 21 def [](field_name) return @operation.code.to_i if field_name == "@status" @operation[field_name] end |
#attach!(signature) ⇒ Object
26 27 28 29 |
# File 'lib/linzer/message/adapter/net_http/response.rb', line 26 def attach!(signature) signature.to_h.each { |h, v| @operation[h] = v } @operation end |
#headers ⇒ Object
16 17 18 |
# File 'lib/linzer/message/adapter/net_http/response.rb', line 16 def headers @operation.each_header.to_h end |