Class: WEB_API::Auto

Inherits:
WebApi show all
Defined in:
lib/web_api/auto.rb

Instance Attribute Summary

Attributes inherited from WebApi

#webmethods

Instance Method Summary collapse

Methods inherited from WebApi

#_add, #_url, #add, trace, trace=

Constructor Details

#initialize(base) ⇒ Auto

base no longer optional



6
7
8
# File 'lib/web_api/auto.rb', line 6

def initialize(base)
  super(base)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/web_api/auto.rb', line 10

def method_missing(symbol , *args)
  if @webmethods.has_key?(symbol)
    return @webmethods[symbol].call(args)
  end
  path = (args.length > 0)? (symbol.to_s + '/' + args.join('/')) : symbol.to_s
  uri = URI.parse _url(path)
  WebApiMethod.new(uri, :get).call([])
end