# The base URI for the service.
# @param [String] method_name
# The identifier for the method.
- # @param [Hash] method_description
+ # @param [Hash] discovery_document
# The section of the discovery document that applies to this method.
#
# @return [Google::APIClient::Method] The constructed method object.
@discovery_document = discovery_document
end
+ # @return [String] unparsed discovery document for the method
+ attr_reader :discovery_document
+
##
# Returns the API this method belongs to.
#
# @return [String] The method identifier.
attr_reader :name
- ##
- # Returns the parsed section of the discovery document that applies to
- # this method.
- #
- # @return [Hash] The method description.
- attr_reader :description
-
##
# Returns the base URI for the method.
#
##
# Updates the method 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 method.
def method_base=(new_method_base)
@method_base = Addressable::URI.parse(new_method_base)
@uri_template = nil
end
+ ##
+ # Returns a human-readable description of the method.
+ #
+ # @return [Hash] The API description.
+ def description
+ return @discovery_document['description']
+ end
+
##
# Returns the method ID.
#
# @return [Addressable::Template] The URI template.
def uri_template
return @uri_template ||= Addressable::Template.new(
- self.method_base.join(Addressable::URI.parse(@discovery_document['path']))
+ self.method_base.join(Addressable::URI.parse("./" + @discovery_document['path']))
)
end
##
# Expands the method's URI template using a parameter list.
#
+ # @api private
# @param [Hash, Array] parameters
# The parameter list to use.
#
# @return [Addressable::URI] The URI after expansion.
def generate_uri(parameters={})
parameters = self.normalize_parameters(parameters)
+
self.validate_parameters(parameters)
template_variables = self.uri_template.variables
upload_type = parameters.assoc('uploadType') || parameters.assoc('upload_type')
##
# Generates an HTTP request for this method.
#
+ # @api private
# @param [Hash, Array] parameters
# The parameters to send.
# @param [String, StringIO] body The body for the HTTP request.
# Verifies that the parameters are valid for this method. Raises an
# exception if validation fails.
#
+ # @api private
# @param [Hash, Array] parameters
# The parameters to verify.
#