Class: Pipedrive::Client
Instance Method Summary collapse
Methods inherited from Base
#[], #all, #authenticate, #base_uri, #get, #initialize, #metric_key, #prepare_options, #protocol, #resource, #resource_path
Constructor Details
This class inherits a constructor from Pipedrive::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, options, &block) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pipedrive/client.rb', line 29 def method_missing(name, , &block) begin resource(name, ) rescue NameError # Since we're silently loading a Resource Class # we transform this into a NoMethodError to # mask that. Not sure if this is the best idea ever, # but I like it for now. raise NoMethodError, "undefined method '#{name}' for #{self}" end end |
Instance Method Details
#metrics ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/pipedrive/client.rb', line 10 def metrics metrics = {} %i{activities deals organizations persons}.each do |source| metrics[source] = send(source).metrics end metrics end |
#validate_authorization ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/pipedrive/client.rb', line 20 def begin users.metrics true rescue AuthenticationError false end end |