Class: KashflowApi::Api
- Inherits:
-
Object
- Object
- KashflowApi::Api
- Defined in:
- lib/kashflow_api/api.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Api
constructor
A new instance of Api.
-
#method_missing(method, argument = nil) ⇒ Object
Main Handler.
Constructor Details
#initialize ⇒ Api
Returns a new instance of Api.
3 4 5 6 7 |
# File 'lib/kashflow_api/api.rb', line 3 def initialize unless KashflowApi.config.username && KashflowApi.config.password raise "Username and Password required" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, argument = nil) ⇒ Object
Main Handler
14 15 16 17 18 19 20 21 |
# File 'lib/kashflow_api/api.rb', line 14 def method_missing(method, argument = nil) methods = KashflowApi.api_methods if methods.include?(method) KashflowApi::ApiCall.new(method, argument).result else super end end |
Class Method Details
.methods ⇒ Object
9 10 11 |
# File 'lib/kashflow_api/api.rb', line 9 def self.methods @methods ||= generate_method_list end |