Class: FreshdeskApiclient::REST::Client
- Inherits:
-
Object
- Object
- FreshdeskApiclient::REST::Client
- Includes:
- Utils::Loggeable
- Defined in:
- lib/freshdesk_apiclient/rest/client.rb
Constant Summary collapse
- RESOURCES =
%i(tickets).freeze
Instance Method Summary collapse
-
#initialize(domain: FreshdeskApiclient.domain, username_or_api_key: FreshdeskApiclient.username_or_api_key, password: FreshdeskApiclient.password, logger: FreshdeskApiclient.logger) ⇒ Client
constructor
A new instance of Client.
-
#method_missing(symbol, *arguments, &block) ⇒ Object
obj.method_missing(symbol [, *args] ) -> result.
- #respond_to_missing?(method) ⇒ Boolean
Methods included from Utils::Loggeable
Constructor Details
#initialize(domain: FreshdeskApiclient.domain, username_or_api_key: FreshdeskApiclient.username_or_api_key, password: FreshdeskApiclient.password, logger: FreshdeskApiclient.logger) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 |
# File 'lib/freshdesk_apiclient/rest/client.rb', line 17 def initialize(domain: FreshdeskApiclient.domain, username_or_api_key: FreshdeskApiclient.username_or_api_key, password: FreshdeskApiclient.password, logger: FreshdeskApiclient.logger) @base_url = "https://#{domain}.freshdesk.com/api/v2/" @credentials = {user: username_or_api_key, password: password} @logger = logger end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *arguments, &block) ⇒ Object
obj.method_missing(symbol [, *args] ) -> result
26 27 28 |
# File 'lib/freshdesk_apiclient/rest/client.rb', line 26 def method_missing(symbol, *arguments, &block) RESOURCES.include?(symbol) ? instance_variable(symbol) : super end |
Instance Method Details
#respond_to_missing?(method) ⇒ Boolean
30 31 32 |
# File 'lib/freshdesk_apiclient/rest/client.rb', line 30 def respond_to_missing?(method, *) RESOURCES.include?(method) ? true : super end |