Module: ActiveCampaign::API::ClassMethods
- Defined in:
- lib/active_campaign/api.rb
Overview
Extends the base class when ActiveCampaign::API is included
Instance Method Summary collapse
-
#endpoint(endpoint) ⇒ void
Utility method to avoid some duplication for requiring files and including API modules.
-
#endpoints(*endpoints) ⇒ void
Utility method to avoid some duplication for requiring files and including.
-
#logger ⇒ Logger
Memoized logger for convenience.
Instance Method Details
#endpoint(endpoint) ⇒ void
This method returns an undefined value.
Utility method to avoid some duplication for requiring files and including API modules
40 41 42 43 44 45 46 |
# File 'lib/active_campaign/api.rb', line 40 def endpoint(endpoint) require "active_campaign/api/#{endpoint}" class_eval { include API.const_get(endpoint.to_s.camelize) } rescue LoadError, NameError raise DependencyMissing, endpoint end |
#endpoints(*endpoints) ⇒ void
This method returns an undefined value.
Utility method to avoid some duplication for requiring files and including
27 28 29 30 31 |
# File 'lib/active_campaign/api.rb', line 27 def endpoints(*endpoints) endpoints.each do |endpoint| endpoint(endpoint) end end |
#logger ⇒ Logger
Memoized logger for convenience
54 55 56 |
# File 'lib/active_campaign/api.rb', line 54 def logger @logger ||= ActiveCampaign.logger end |