Merge branch 'master' of https://code.google.com/p/google-api-ruby-client
This commit is contained in:
commit
6c0359720c
|
@ -44,7 +44,7 @@ module Google
|
|||
@document_base = Addressable::URI.parse(document_base)
|
||||
@discovery_document = discovery_document
|
||||
metaclass = (class <<self; self; end)
|
||||
self.resources.each do |resource|
|
||||
self.discovered_resources.each do |resource|
|
||||
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
|
||||
if !self.respond_to?(method_name)
|
||||
metaclass.send(:define_method, method_name) { resource }
|
||||
|
@ -164,7 +164,7 @@ module Google
|
|||
# The new base URI to use for the service.
|
||||
def method_base=(new_method_base)
|
||||
@method_base = Addressable::URI.parse(new_method_base)
|
||||
self.resources.each do |resource|
|
||||
self.discovered_resources.each do |resource|
|
||||
resource.method_base = @method_base
|
||||
end
|
||||
self.methods.each do |method|
|
||||
|
@ -207,7 +207,7 @@ module Google
|
|||
# API.
|
||||
#
|
||||
# @return [Array] A list of {Google::APIClient::Resource} objects.
|
||||
def resources
|
||||
def discovered_resources
|
||||
return @resources ||= (
|
||||
(@discovery_document['resources'] || []).inject([]) do |accu, (k, v)|
|
||||
accu << Google::APIClient::Resource.new(
|
||||
|
@ -252,7 +252,7 @@ module Google
|
|||
self.methods.each do |method|
|
||||
methods_hash[method.id] = method
|
||||
end
|
||||
self.resources.each do |resource|
|
||||
self.discovered_resources.each do |resource|
|
||||
methods_hash.merge!(resource.to_h)
|
||||
end
|
||||
methods_hash
|
||||
|
|
|
@ -42,7 +42,7 @@ module Google
|
|||
@name = resource_name
|
||||
@discovery_document = discovery_document
|
||||
metaclass = (class <<self; self; end)
|
||||
self.resources.each do |resource|
|
||||
self.discovered_resources.each do |resource|
|
||||
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
|
||||
if !self.respond_to?(method_name)
|
||||
metaclass.send(:define_method, method_name) { resource }
|
||||
|
@ -82,7 +82,7 @@ module Google
|
|||
# The new base URI to use for the resource.
|
||||
def method_base=(new_method_base)
|
||||
@method_base = Addressable::URI.parse(new_method_base)
|
||||
self.resources.each do |resource|
|
||||
self.discovered_resources.each do |resource|
|
||||
resource.method_base = @method_base
|
||||
end
|
||||
self.methods.each do |method|
|
||||
|
@ -94,7 +94,7 @@ module Google
|
|||
# A list of sub-resources available on this resource.
|
||||
#
|
||||
# @return [Array] A list of {Google::APIClient::Resource} objects.
|
||||
def resources
|
||||
def discovered_resources
|
||||
return @resources ||= (
|
||||
(@discovery_document['resources'] || []).inject([]) do |accu, (k, v)|
|
||||
accu << Google::APIClient::Resource.new(
|
||||
|
@ -129,7 +129,7 @@ module Google
|
|||
self.methods.each do |method|
|
||||
methods_hash[method.id] = method
|
||||
end
|
||||
self.resources.each do |resource|
|
||||
self.discovered_resources.each do |resource|
|
||||
methods_hash.merge!(resource.to_h)
|
||||
end
|
||||
methods_hash
|
||||
|
|
|
@ -74,20 +74,20 @@ module Google
|
|||
Google::INFLECTOR.camelize(api.name)
|
||||
api_version_string =
|
||||
Google::INFLECTOR.camelize(api.version).gsub('.', '_')
|
||||
if Google::APIClient::Schema.const_defined?(api_name_string)
|
||||
api_name = Google::APIClient::Schema.const_get(api_name_string)
|
||||
if Google::APIClient::Schema.const_defined?(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
|
||||
)
|
||||
end
|
||||
if api_name.const_defined?(api_version_string)
|
||||
api_version = api_name.const_get(api_version_string)
|
||||
if api_name.const_defined?(api_version_string, false)
|
||||
api_version = api_name.const_get(api_version_string, false)
|
||||
else
|
||||
api_version = api_name.const_set(api_version_string, Module.new)
|
||||
end
|
||||
if api_version.const_defined?(schema_name)
|
||||
schema_class = api_version.const_get(schema_name)
|
||||
if api_version.const_defined?(schema_name, false)
|
||||
schema_class = api_version.const_get(schema_name, false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ require 'signet/oauth_1/client'
|
|||
|
||||
require 'google/api_client'
|
||||
require 'google/api_client/version'
|
||||
require 'google/api_client/parsers/json_parser'
|
||||
|
||||
describe Google::APIClient do
|
||||
before do
|
||||
|
|
|
@ -23,7 +23,6 @@ require 'signet/oauth_1/client'
|
|||
|
||||
require 'google/api_client'
|
||||
require 'google/api_client/version'
|
||||
require 'google/api_client/parsers/json_parser'
|
||||
|
||||
shared_examples_for 'configurable user agent' do
|
||||
it 'should allow the user agent to be modified' do
|
||||
|
|
Loading…
Reference in New Issue