X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/80c41c99fc91c9818dbc7c5840b584de4d48ae23..1fca089d622036e21db40e94f24f85e375969e5c:/lib/google/api_client/discovery/api.rb diff --git a/lib/google/api_client/discovery/api.rb b/lib/google/api_client/discovery/api.rb index c4afb38af8..6d9b07d2a0 100644 --- a/lib/google/api_client/discovery/api.rb +++ b/lib/google/api_client/discovery/api.rb @@ -18,7 +18,7 @@ require 'addressable/uri' require 'google/inflection' require 'google/api_client/discovery/resource' require 'google/api_client/discovery/method' - +require 'google/api_client/discovery/media' module Google class APIClient @@ -29,13 +29,9 @@ module Google ## # Creates a description of a particular version of a service. # - # @param [String] api - # The identifier for the service. Note that while this frequently - # matches the first segment of all of the service's RPC names, this - # should not be assumed. There is no requirement that these match. - # @param [String] version - # The identifier for the service version. - # @param [Hash] api_description + # @param [String] document_base + # Base URI for the service + # @param [Hash] discovery_document # The section of the discovery document that applies to this service # version. # @@ -149,8 +145,7 @@ module Google def method_base if @discovery_document['basePath'] return @method_base ||= ( - self.document_base + - Addressable::URI.parse(@discovery_document['basePath']) + self.document_base.join(Addressable::URI.parse(@discovery_document['basePath'])) ).normalize else return nil @@ -160,7 +155,7 @@ module Google ## # Updates the hierarchy of resources and methods with the new base. # - # @param [Addressable::URI, #to_str, String] new_base + # @param [Addressable::URI, #to_str, String] new_method_base # The new base URI to use for the service. def method_base=(new_method_base) @method_base = Addressable::URI.parse(new_method_base) @@ -172,6 +167,21 @@ module Google end end + ## + # Returns the base URI for batch calls to this service. + # + # @return [Addressable::URI] The base URI that methods are joined to. + def batch_path + if @discovery_document['batchPath'] + return @batch_path ||= ( + self.document_base.join(Addressable::URI.parse('/' + + @discovery_document['batchPath'])) + ).normalize + else + return nil + end + end + ## # A list of schemas available for this version of the API. #