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.
42 43 44 |
# File 'lib/yao/client.rb', line 42 def default_client @default_client end |
Class Method Details
.client_generator ⇒ Object
44 45 46 |
# File 'lib/yao/client.rb', line 44 def client_generator Plugins::Registry.instance[:client_generator][Yao.config.client_generator].new end |
.client_options ⇒ Object
60 61 62 63 64 |
# File 'lib/yao/client.rb', line 60 def opt = {} opt.merge!({ request: { timeout: Yao.config.timeout }}) if Yao.config.timeout opt end |
.gen_client(endpoint, token: nil) ⇒ Object
48 49 50 51 52 |
# File 'lib/yao/client.rb', line 48 def gen_client(endpoint, token: nil) Faraday.new( endpoint, ) do |f| client_generator.call(f, token) end end |
.reset_client(new_endpoint = nil) ⇒ Object
54 55 56 57 58 |
# File 'lib/yao/client.rb', line 54 def reset_client(new_endpoint=nil) set = ClientSet.new set.register_endpoints("default" => {public_url: new_endpoint || Yao.config.endpoint}) self.default_client = set end |