Class: ThreeScaleToolbox::ThreeScaleClientFactory
- Inherits:
-
Object
- Object
- ThreeScaleToolbox::ThreeScaleClientFactory
- Defined in:
- lib/3scale_toolbox/3scale_client_factory.rb
Instance Attribute Summary collapse
-
#remote_str ⇒ Object
readonly
Returns the value of attribute remote_str.
-
#remotes ⇒ Object
readonly
Returns the value of attribute remotes.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
-
#verify_ssl ⇒ Object
readonly
Returns the value of attribute verify_ssl.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(remotes, remote_str, verify_ssl, verbose) ⇒ ThreeScaleClientFactory
constructor
A new instance of ThreeScaleClientFactory.
Constructor Details
#initialize(remotes, remote_str, verify_ssl, verbose) ⇒ ThreeScaleClientFactory
Returns a new instance of ThreeScaleClientFactory.
11 12 13 14 15 16 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 11 def initialize(remotes, remote_str, verify_ssl, verbose) @remotes = remotes @remote_str = remote_str @verify_ssl = verify_ssl @verbose = verbose end |
Instance Attribute Details
#remote_str ⇒ Object (readonly)
Returns the value of attribute remote_str.
9 10 11 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 9 def remote_str @remote_str end |
#remotes ⇒ Object (readonly)
Returns the value of attribute remotes.
9 10 11 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 9 def remotes @remotes end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
9 10 11 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 9 def verbose @verbose end |
#verify_ssl ⇒ Object (readonly)
Returns the value of attribute verify_ssl.
9 10 11 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 9 def verify_ssl @verify_ssl end |
Class Method Details
.get(remotes, remote_str, verify_ssl, verbose = false) ⇒ Object
4 5 6 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 4 def get(remotes, remote_str, verify_ssl, verbose = false) new(remotes, remote_str, verify_ssl, verbose).call end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/3scale_toolbox/3scale_client_factory.rb', line 18 def call begin remote = Remotes.from_uri(remote_str) rescue InvalidUrlError remote = remotes.fetch(remote_str) end client = remote_client(remote.merge(verify_ssl: verify_ssl)) return ProxyLogger.new(client) if verbose client end |