Class: HTTPX::Plugins::GRPC::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/httpx/plugins/grpc/call.rb

Overview

Encapsulates call information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Call

Returns a new instance of Call.



10
11
12
13
14
15
# File 'lib/httpx/plugins/grpc/call.rb', line 10

def initialize(response)
  @response = response
  @decoder = ->(z) { z }
  @consumed = false
  @grpc_response = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object (private)



55
56
57
58
59
# File 'lib/httpx/plugins/grpc/call.rb', line 55

def method_missing(meth, *args, &blk)
  return grpc_response.__send__(meth, *args, &blk) if grpc_response.respond_to?(meth)

  super
end

Instance Attribute Details

#decoder=(value) ⇒ Object (writeonly)

Sets the attribute decoder

Parameters:

  • value

    the value to set the attribute decoder to.



8
9
10
# File 'lib/httpx/plugins/grpc/call.rb', line 8

def decoder=(value)
  @decoder = value
end

Instance Method Details

#inspectObject



17
18
19
# File 'lib/httpx/plugins/grpc/call.rb', line 17

def inspect
  "#GRPC::Call(#{grpc_response})"
end

#metadataObject



25
26
27
# File 'lib/httpx/plugins/grpc/call.rb', line 25

def 
  response.headers
end

#to_sObject



21
22
23
# File 'lib/httpx/plugins/grpc/call.rb', line 21

def to_s
  grpc_response.to_s
end

#trailing_metadataObject



29
30
31
32
33
# File 'lib/httpx/plugins/grpc/call.rb', line 29

def 
  return unless @consumed

  @response.
end