blob: 955887a4d8a5994cc2c742160a99b900451e71eb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
module ActionService # :nodoc:
module Client # :nodoc:
class ClientError < StandardError # :nodoc:
end
class Base # :nodoc:
def initialize(api, endpoint_uri)
@api = api
@endpoint_uri = endpoint_uri
end
def method_missing(name, *args) # :nodoc:
call_name = method_name(name)
return super(name, *args) if call_name.nil?
perform_invocation(call_name, args)
end
protected
def perform_invocation(method_name, args) # :nodoc:
raise NotImplementedError, "use a protocol-specific client"
end
private
def method_name(name)
if @api.has_api_method?(name.to_sym)
name.to_s
elsif @api.has_public_api_method?(name.to_s)
@api.api_method_name(name.to_s).to_s
else
nil
end
end
end
end
end
|