Module: Yao::Client
- Defined in:
- lib/yao/client.rb
Defined Under Namespace
Classes: ClientSet
Class Attribute Summary collapse
-
.default_client ⇒ Object
Returns the value of attribute default_client.
Class Method Summary collapse
- .client_generator ⇒ Object
- .client_options ⇒ Object
- .gen_client(endpoint, token: nil) ⇒ Object
- .reset_client(new_endpoint = nil) ⇒ Object
Class Attribute Details
.default_client ⇒ Object
Returns the value of attribute default_client.
46 47 48 |
# File 'lib/yao/client.rb', line 46 def default_client @default_client end |
Class Method Details
.client_generator ⇒ Object
48 49 50 |
# File 'lib/yao/client.rb', line 48 def client_generator Plugins::Registry.instance[:client_generator][Yao.config.client_generator].new end |
.client_options ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/yao/client.rb', line 64 def opt = {} opt.merge!({ request: { timeout: Yao.config.timeout }}) if Yao.config.timeout if Yao.config.client_cert && Yao.config.client_key require 'openssl' cert = OpenSSL::X509::Certificate.new(File.read(Yao.config.client_cert)) key = OpenSSL::PKey.read(File.read(Yao.config.client_key)) opt.merge!(ssl: { client_cert: cert, client_key: key, }) end opt end |
.gen_client(endpoint, token: nil) ⇒ Object
52 53 54 55 56 |
# File 'lib/yao/client.rb', line 52 def gen_client(endpoint, token: nil) Faraday.new( endpoint, ) do |f| client_generator.call(f, token) end end |