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 |
# File 'lib/openlab/client.rb', line 10 def initialize(app_secret: nil) @app_secret = app_secret || Openlab.config.app_secret app_secret = @app_secret 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
22 23 24 |
# File 'lib/openlab/client.rb', line 22 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
18 19 20 |
# File 'lib/openlab/client.rb', line 18 def projects @projects ||= Openlab::Projects.new(self) end |
#respond_to?(method_name, include_private = false) ⇒ Boolean
26 27 28 |
# File 'lib/openlab/client.rb', line 26 def respond_to?(method_name, include_private = false) self.class.respond_to?(method_name) || super end |