Class: Botaku::Client::WebApiModule
- Inherits:
-
Object
- Object
- Botaku::Client::WebApiModule
- Defined in:
- lib/botaku/client.rb
Instance Method Summary collapse
-
#initialize(client, name) ⇒ WebApiModule
constructor
A new instance of WebApiModule.
- #method_missing(meth, *args) ⇒ Object
Constructor Details
#initialize(client, name) ⇒ WebApiModule
Returns a new instance of WebApiModule.
159 160 161 162 |
# File 'lib/botaku/client.rb', line 159 def initialize(client, name) @client = client @name = name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
163 164 165 166 167 168 |
# File 'lib/botaku/client.rb', line 163 def method_missing(meth, *args) args = [ {} ] if args.empty? return super if args.size != 1 || ! args[0].is_a?(Hash) r = @client.send(:get, @name, meth, args.first) JSON.parse(r.body) end |