Merge pull request #213 from remi/respect-discovered-rootUrl
Use discovered 'rootUrl' as base URI for services
This commit is contained in:
commit
0003e564b1
2 files changed
+42
-2
No files matched your search
@@ -30,7 +30,7 @@ module Google
|
||||
# Creates a description of a particular version of a service.
|
||||
#
|
||||
# @param [String] document_base
|
||||
# Base URI for the service
|
||||
# Base URI for the discovery document.
|
||||
# @param [Hash] discovery_document
|
||||
# The section of the discovery document that applies to this service
|
||||
# version.
|
||||
@@ -126,6 +126,16 @@ module Google
|
||||
return @discovery_document['features'] || []
|
||||
end
|
||||
|
||||
##
|
||||
# Returns the root URI for this service.
|
||||
#
|
||||
# @return [Addressable::URI] The root URI.
|
||||
def root_uri
|
||||
return @root_uri ||= (
|
||||
Addressable::URI.parse(self.discovery_document['rootUrl'])
|
||||
)
|
||||
end
|
||||
|
||||
##
|
||||
# Returns true if this API uses a data wrapper.
|
||||
#
|
||||
@@ -148,7 +158,7 @@ module Google
|
||||
def method_base
|
||||
if @discovery_document['basePath']
|
||||
return @method_base ||= (
|
||||
self.document_base.join(Addressable::URI.parse(@discovery_document['basePath']))
|
||||
self.root_uri.join(Addressable::URI.parse(@discovery_document['basePath']))
|
||||
).normalize
|
||||
else
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user