Added ability to update the base URI in services, resources, and methods.
git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@102 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
1 parent
f63bf8199f
commit
38f5bc5baf
2 files changed
+52
No files matched your search
@@ -89,6 +89,21 @@ module Google
|
||||
return @base ||= Addressable::URI.parse(self.description['baseUrl'])
|
||||
end
|
||||
|
||||
##
|
||||
# Updates the hierarchy of resources and methods with the new base.
|
||||
#
|
||||
# @param [Addressable::URI, #to_str, String] new_base
|
||||
# The new base URI to use for the service.
|
||||
def base=(new_base)
|
||||
@base = Addressable::URI.parse(new_base)
|
||||
self.resources.each do |resource|
|
||||
resource.base = @base
|
||||
end
|
||||
self.methods.each do |method|
|
||||
method.base = @base
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# A list of resources available at the root level of this version of the
|
||||
# service.
|
||||
@@ -244,6 +259,21 @@ module Google
|
||||
# @return [Addressable::URI] The base URI that methods are joined to.
|
||||
attr_reader :base
|
||||
|
||||
##
|
||||
# Updates the hierarchy of resources and methods with the new base.
|
||||
#
|
||||
# @param [Addressable::URI, #to_str, String] new_base
|
||||
# The new base URI to use for the resource.
|
||||
def base=(new_base)
|
||||
@base = Addressable::URI.parse(new_base)
|
||||
self.resources.each do |resource|
|
||||
resource.base = @base
|
||||
end
|
||||
self.methods.each do |method|
|
||||
method.base = @base
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# A list of sub-resources available on this resource.
|
||||
#
|
||||
@@ -340,6 +370,16 @@ module Google
|
||||
# The base URI that this method will be joined to.
|
||||
attr_reader :base
|
||||
|
||||
##
|
||||
# Updates the method with the new base.
|
||||
#
|
||||
# @param [Addressable::URI, #to_str, String] new_base
|
||||
# The new base URI to use for the method.
|
||||
def base=(new_base)
|
||||
@base = Addressable::URI.parse(new_base)
|
||||
@uri_template = nil
|
||||
end
|
||||
|
||||
##
|
||||
# Returns the RPC name for the method.
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user