Class: KashflowApi::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/kashflow_api/api.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApi

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

.methodsObject



9
10
11
# File 'lib/kashflow_api/api.rb', line 9

def self.methods
    @methods ||= generate_method_list
end