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)


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

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



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

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

#option_grpc_deadline(value) ⇒ Object

Raises:

  • (TypeError)


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

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

  value
end

#option_grpc_rpcs(value) ⇒ Object



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

def option_grpc_rpcs(value)
  Hash[value]
end

#option_grpc_service(value) ⇒ Object



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

def option_grpc_service(value)
  String(value)
end