Class: PipedriveRuby::PipedriveClient
- Inherits:
-
Object
- Object
- PipedriveRuby::PipedriveClient
- Defined in:
- lib/pipedrive_client.rb
Overview
This class is for hold the client informations (API TOKEN, resources)
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
Instance Method Summary collapse
-
#initialize(api_token) ⇒ PipedriveClient
constructor
A new instance of PipedriveClient.
-
#method_missing(method) ⇒ Object
this delegation is only to allow user make PipedriveClient.new(“token”).resource where resource could be deals organizations etc…
Constructor Details
#initialize(api_token) ⇒ PipedriveClient
Returns a new instance of PipedriveClient
8 9 10 |
# File 'lib/pipedrive_client.rb', line 8 def initialize(api_token) @api_token = api_token end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
this delegation is only to allow user make PipedriveClient.new(“token”).resource where resource could be deals organizations etc…
14 15 16 17 18 19 20 21 |
# File 'lib/pipedrive_client.rb', line 14 def method_missing(method) begin class_name = 'PipedriveRuby::' + method.to_s.split("_").collect(&:capitalize).join Object.const_get(class_name).new(self) rescue NameError "#{method} class not found" end end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token
6 7 8 |
# File 'lib/pipedrive_client.rb', line 6 def api_token @api_token end |