Class: WotApiRu::Client
- Inherits:
-
Object
- Object
- WotApiRu::Client
- Defined in:
- lib/wot_api_ru/client.rb
Overview
Class of client for send response to Wargaming.net Public API
Instance Method Summary collapse
-
#method_missing(meth, *args, &block) ⇒ Object
This method dynamic call Wargaming.net Public API methods from WotApiRu::PATH values.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
Note:
If you call method which undefined as key in WotApiRu::PATH then method raise NoMethodError
This method dynamic call Wargaming.net Public API methods from WotApiRu::PATH values
11 12 13 14 15 16 17 |
# File 'lib/wot_api_ru/client.rb', line 11 def method_missing(meth, *args, &block) raise NoMethodError, "undefined method #{meth} for #{self.class.to_s}" if WotApiRu::Constants::PATH[meth.to_sym].nil? = args[0] || {} [:application_id] ||= WotApiRu::Settings[:application_id] path = WotApiRu::Constants::HOST + WotApiRu::Constants::PATH[meth.to_sym] invoke(path, ) end |