Class: ZammadAPI::Client
- Inherits:
-
Object
- Object
- ZammadAPI::Client
- Extended by:
- Forwardable
- Defined in:
- lib/zammad_api/client.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method, *_args) ⇒ Object
- #perform_on_behalf_of(identifier) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *_args) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zammad_api/client.rb', line 29 def method_missing(method, *_args) method = modulize( method.to_s ) class_name = "ZammadAPI::Resources::#{method}" begin class_object = Kernel.const_get(class_name) rescue raise "Resource for #{method} does not exist" end ZammadAPI::Dispatcher.new(@transport, class_object) end |
Instance Method Details
#perform_on_behalf_of(identifier) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/zammad_api/client.rb', line 22 def perform_on_behalf_of(identifier) self.on_behalf_of = identifier yield.tap do |_| self.on_behalf_of = nil end end |