Method renames to be consistent with change to resources.

This commit is contained in:
Bob Aman 2012-02-10 17:26:44 +03:00
parent 6c0359720c
commit 1a381ab963
3 changed files with 15 additions and 13 deletions

View File

@ -50,7 +50,7 @@ module Google
metaclass.send(:define_method, method_name) { resource }
end
end
self.methods.each do |method|
self.discovered_methods.each do |method|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) { method }
@ -167,7 +167,7 @@ module Google
self.discovered_resources.each do |resource|
resource.method_base = @method_base
end
self.methods.each do |method|
self.discovered_methods.each do |method|
method.method_base = @method_base
end
end
@ -208,7 +208,7 @@ module Google
#
# @return [Array] A list of {Google::APIClient::Resource} objects.
def discovered_resources
return @resources ||= (
return @discovered_resources ||= (
(@discovery_document['resources'] || []).inject([]) do |accu, (k, v)|
accu << Google::APIClient::Resource.new(
self, self.method_base, k, v
@ -223,8 +223,8 @@ module Google
# API.
#
# @return [Array] A list of {Google::APIClient::Method} objects.
def methods
return @methods ||= (
def discovered_methods
return @discovered_methods ||= (
(@discovery_document['methods'] || []).inject([]) do |accu, (k, v)|
accu << Google::APIClient::Method.new(self, self.method_base, k, v)
accu
@ -249,7 +249,7 @@ module Google
def to_h
return @hash ||= (begin
methods_hash = {}
self.methods.each do |method|
self.discovered_methods.each do |method|
methods_hash[method.id] = method
end
self.discovered_resources.each do |resource|

View File

@ -48,7 +48,7 @@ module Google
metaclass.send(:define_method, method_name) { resource }
end
end
self.methods.each do |method|
self.discovered_methods.each do |method|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) { method }
@ -85,7 +85,7 @@ module Google
self.discovered_resources.each do |resource|
resource.method_base = @method_base
end
self.methods.each do |method|
self.discovered_methods.each do |method|
method.method_base = @method_base
end
end
@ -95,7 +95,7 @@ module Google
#
# @return [Array] A list of {Google::APIClient::Resource} objects.
def discovered_resources
return @resources ||= (
return @discovered_resources ||= (
(@discovery_document['resources'] || []).inject([]) do |accu, (k, v)|
accu << Google::APIClient::Resource.new(
@api, self.method_base, k, v
@ -109,8 +109,8 @@ module Google
# A list of methods available on this resource.
#
# @return [Array] A list of {Google::APIClient::Method} objects.
def methods
return @methods ||= (
def discovered_methods
return @discovered_methods ||= (
(@discovery_document['methods'] || []).inject([]) do |accu, (k, v)|
accu << Google::APIClient::Method.new(@api, self.method_base, k, v)
accu
@ -126,7 +126,7 @@ module Google
def to_h
return @hash ||= (begin
methods_hash = {}
self.methods.each do |method|
self.discovered_methods.each do |method|
methods_hash[method.id] = method
end
self.discovered_resources.each do |resource|

View File

@ -75,7 +75,9 @@ module Google
api_version_string =
Google::INFLECTOR.camelize(api.version).gsub('.', '_')
if Google::APIClient::Schema.const_defined?(api_name_string, false)
api_name = Google::APIClient::Schema.const_get(api_name_string, false)
api_name = Google::APIClient::Schema.const_get(
api_name_string, false
)
else
api_name = Google::APIClient::Schema.const_set(
api_name_string, Module.new