Class: Openlab::Client
- Inherits:
-
Object
- Object
- Openlab::Client
- Includes:
- HTTParty
- Defined in:
- lib/openlab/client.rb
Instance Attribute Summary collapse
-
#app_secret ⇒ Object
readonly
Returns the value of attribute app_secret.
Instance Method Summary collapse
-
#initialize(app_secret: nil) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #projects ⇒ Object
- #respond_to?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(app_secret: nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 |
# File 'lib/openlab/client.rb', line 10 def initialize(app_secret: nil) @app_secret = app_secret || Openlab.config.app_secret self.class.[:verify] = Openlab.config.httparty_verify self.class.[:verify_peer] = Openlab.config.httparty_verify_peer self.class.base_uri Openlab.config.base_uri self.class.headers 'Accept' => 'application/json', 'Authorization' => "Token token=#{@app_secret}" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
23 24 25 |
# File 'lib/openlab/client.rb', line 23 def method_missing(method_name, *arguments, &block) self.class.respond_to?(method_name) ? self.class.__send__(method_name, *arguments, &block) : super end |
Instance Attribute Details
#app_secret ⇒ Object (readonly)
Returns the value of attribute app_secret.
7 8 9 |
# File 'lib/openlab/client.rb', line 7 def app_secret @app_secret end |
Instance Method Details
#projects ⇒ Object
19 20 21 |
# File 'lib/openlab/client.rb', line 19 def projects @projects ||= Openlab::Projects.new(self) end |
#respond_to?(method_name, include_private = false) ⇒ Boolean
27 28 29 |
# File 'lib/openlab/client.rb', line 27 def respond_to?(method_name, include_private = false) self.class.respond_to?(method_name) || super end |