2010-08-11 19:11:06 +00:00
|
|
|
# Copyright 2010 Google Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
require "json"
|
2010-08-11 21:20:13 +00:00
|
|
|
require "addressable/template"
|
2010-08-11 19:11:06 +00:00
|
|
|
|
|
|
|
module Google #:nodoc:
|
|
|
|
class APIClient #:nodoc:
|
|
|
|
class Discovery
|
2010-08-14 01:16:35 +00:00
|
|
|
##
|
|
|
|
# The default discovery configuration values. These may be overrided
|
|
|
|
# simply by passing in the same key to the constructor.
|
|
|
|
DEFAULTS = {
|
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
# A set of default configuration values specific to each service. These
|
|
|
|
# may be overrided simply by passing in the same key to the constructor.
|
|
|
|
SERVICE_DEFAULTS = {
|
|
|
|
}
|
2010-08-11 19:11:06 +00:00
|
|
|
|
2010-08-14 01:16:35 +00:00
|
|
|
##
|
|
|
|
# Creates a new API discovery handler.
|
|
|
|
#
|
|
|
|
# @param [Hash] options
|
|
|
|
#
|
|
|
|
# @return [Google::APIClient::Discovery] The API discovery handler.
|
|
|
|
def initialize(options={})
|
|
|
|
if options[:service] && SERVICE_DEFAULTS[options[:service]]
|
|
|
|
@options = DEFAULTS.merge(SERVICE_DEFAULTS[options[:service]])
|
|
|
|
else
|
|
|
|
@options = DEFAULTS.clone
|
|
|
|
end
|
|
|
|
@options.merge!(options)
|
|
|
|
# Handle any remaining configuration here
|
|
|
|
end
|
|
|
|
|
|
|
|
##
|
|
|
|
# Returns the configuration of the handler. Configuration options that
|
|
|
|
# are not recognized by the handler are ignored.
|
|
|
|
#
|
|
|
|
# @return [Hash] The configuration options.
|
|
|
|
def options
|
|
|
|
return @options
|
|
|
|
end
|
2010-08-11 19:11:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|