31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/hive/jsonrpc.rb', line 31
def get_api_methods(&block)
api_methods = self.class.api_methods[@rpc_client.uri.to_s]
if api_methods.nil?
get_methods do |result, error, rpc_id|
raise NotAppBaseError, "#{@rpc_client.uri} does not appear to run AppBase" unless defined? result.map
methods = result.map do |method|
method.split('.').map(&:to_sym)
end
api_methods = Hashie::Mash.new
methods.each do |api, method|
api_methods[api] ||= []
api_methods[api] << method
end
self.class.api_methods[@rpc_client.uri.to_s] = api_methods
end
end
if !!block
api_methods.each do |api, methods|
yield api, methods
end
else
return api_methods
end
end
|