Module: HTTPX::Plugins::GRPC::OptionsMethods

Defined in:
lib/httpx/plugins/grpc.rb

Instance Method Summary collapse

Instance Method Details

#option_call_credentials(value) ⇒ Object

Raises:

  • (TypeError)


97
98
99
100
101
# File 'lib/httpx/plugins/grpc.rb', line 97

def option_call_credentials(value)
  raise TypeError, ":call_credentials must respond to #call" unless value.respond_to?(:call)

  value
end

#option_grpc_compression(value) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/httpx/plugins/grpc.rb', line 78

def option_grpc_compression(value)
  case value
  when true, false
    value
  else
    value.to_s
  end
end

#option_grpc_deadline(value) ⇒ Object

Raises:

  • (TypeError)


91
92
93
94
95
# File 'lib/httpx/plugins/grpc.rb', line 91

def option_grpc_deadline(value)
  raise TypeError, ":grpc_deadline must be positive" unless value.positive?

  value
end

#option_grpc_rpcs(value) ⇒ Object



87
88
89
# File 'lib/httpx/plugins/grpc.rb', line 87

def option_grpc_rpcs(value)
  Hash[value]
end

#option_grpc_service(value) ⇒ Object



74
75
76
# File 'lib/httpx/plugins/grpc.rb', line 74

def option_grpc_service(value)
  String(value)
end