Fixed some YARD documentation issues and changed how the user-agent is built.

This commit is contained in:
Bob Aman 2011-12-02 16:43:55 +03:00
parent 6205c8e67c
commit 321533455c
13 changed files with 42 additions and 6 deletions

View File

@ -24,6 +24,7 @@ require 'google/api_client/discovery'
require 'google/api_client/reference' require 'google/api_client/reference'
require 'google/api_client/result' require 'google/api_client/result'
module Google module Google
# TODO(bobaman): Document all this stuff. # TODO(bobaman): Document all this stuff.
@ -47,8 +48,9 @@ module Google
# @option options [String] :host ("www.googleapis.com") # @option options [String] :host ("www.googleapis.com")
# The API hostname used by the client. This rarely needs to be changed. # The API hostname used by the client. This rarely needs to be changed.
# @option options [String] :application_name # @option options [String] :application_name
# The name and version of the application using the client. This should # The name of the application using the client.
# be given in the form `"{name}/{version}"`. # @option options [String] :application_version
# The version number of the application using the client.
# @option options [String] :user_agent # @option options [String] :user_agent
# ("{app_name} google-api-ruby-client/{version} {os_name}/{os_version}") # ("{app_name} google-api-ruby-client/{version} {os_name}/{os_version}")
# The user agent used by the client. Most developers will want to # The user agent used by the client. Most developers will want to
@ -63,10 +65,16 @@ module Google
self.host = options["host"] || 'www.googleapis.com' self.host = options["host"] || 'www.googleapis.com'
# Most developers will want to leave this value alone and use the # Most developers will want to leave this value alone and use the
# application_name option. # application_name option.
application_string = (
options["application_name"] ? (
"#{options["application_name"]}/" +
"#{options["application_version"] || '0.0.0'}"
) : ""
)
self.user_agent = options["user_agent"] || ( self.user_agent = options["user_agent"] || (
(options["application_name"] || '') "#{application_string} " +
'google-api-ruby-client/' + VERSION::STRING + "google-api-ruby-client/#{VERSION::STRING} " +
' ' + ENV::OS_VERSION ENV::OS_VERSION
).strip ).strip
# The writer method understands a few Symbols and will generate useful # The writer method understands a few Symbols and will generate useful
# default authentication mechanisms. # default authentication mechanisms.
@ -148,7 +156,7 @@ module Google
## ##
# The application's API key issued by the API console. # The application's API key issued by the API console.
# #
# @return [String] The API key.. # @return [String] The API key.
attr_accessor :key attr_accessor :key
## ##

View File

@ -19,6 +19,7 @@ require 'google/inflection'
require 'google/api_client/discovery/resource' require 'google/api_client/discovery/resource'
require 'google/api_client/discovery/method' require 'google/api_client/discovery/method'
module Google module Google
class APIClient class APIClient
## ##

View File

@ -18,6 +18,7 @@ require 'addressable/template'
require 'google/api_client/errors' require 'google/api_client/errors'
module Google module Google
class APIClient class APIClient
## ##

View File

@ -18,6 +18,7 @@ require 'addressable/uri'
require 'google/inflection' require 'google/inflection'
require 'google/api_client/discovery/method' require 'google/api_client/discovery/method'
module Google module Google
class APIClient class APIClient
## ##

View File

@ -23,6 +23,7 @@ require 'addressable/template'
require 'google/inflection' require 'google/inflection'
require 'google/api_client/errors' require 'google/api_client/errors'
module Google module Google
class APIClient class APIClient
module Schema module Schema

View File

@ -1,3 +1,18 @@
# 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.
module Google module Google
class APIClient class APIClient
module ENV module ENV

View File

@ -15,6 +15,7 @@
require 'json' require 'json'
module Google module Google
class APIClient class APIClient
module Parser module Parser

View File

@ -15,6 +15,7 @@
require 'google/api_client/parsers/json_parser' require 'google/api_client/parsers/json_parser'
module Google module Google
class APIClient class APIClient
module JSON module JSON

View File

@ -15,6 +15,7 @@
require 'google/api_client/parsers/json_parser' require 'google/api_client/parsers/json_parser'
module Google module Google
class APIClient class APIClient
module JSON module JSON

View File

@ -16,6 +16,7 @@
require 'json' require 'json'
require 'google/api_client/parser' require 'google/api_client/parser'
module Google module Google
class APIClient class APIClient
## ##

View File

@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
require 'stringio' require 'stringio'
require 'json' require 'json'
require 'addressable/uri' require 'addressable/uri'
require 'google/api_client/discovery' require 'google/api_client/discovery'
module Google module Google
class APIClient class APIClient
class Reference class Reference

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
module Google module Google
class APIClient class APIClient
## ##

View File

@ -15,6 +15,8 @@
# Used to prevent the class/module from being loaded more than once # Used to prevent the class/module from being loaded more than once
if !defined?(::Google::APIClient::VERSION) if !defined?(::Google::APIClient::VERSION)
module Google module Google
class APIClient class APIClient
module VERSION module VERSION