Resolve merge conflict

This commit is contained in:
Steven Bazyl 2014-12-15 11:50:16 -08:00
commit ec670e9fa0
26 changed files with 52 additions and 105 deletions

View File

@ -1,14 +1,10 @@
language: ruby
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1.0
- rbx-2
- jruby-18mode
- jruby-19mode
- ree
script: "bundle exec rake spec:all"
before_install:
- sudo apt-get update

View File

@ -26,7 +26,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'signet', '~> 0.6'
s.add_runtime_dependency 'faraday', '~> 0.9'
s.add_runtime_dependency 'multi_json', '~> 1.10'
s.add_runtime_dependency 'uuidtools', "~> 2.1"
s.add_runtime_dependency 'autoparse', "~> 0.3"
s.add_runtime_dependency 'extlib', '~> 0.9'
s.add_runtime_dependency 'launchy', '~> 2.4'

View File

@ -32,7 +32,7 @@ require 'google/api_client/service_account'
require 'google/api_client/batch'
require 'google/api_client/gzip'
require 'google/api_client/client_secrets'
require 'google/api_client/railtie' if defined?(Rails::Railtie)
require 'google/api_client/railtie' if defined?(Rails)
module Google
@ -692,5 +692,3 @@ module Google
end
end
require 'google/api_client/version'

View File

@ -42,7 +42,7 @@ module Google
##
# Attempt to read in credentials from the specified file.
def load_credentials
if File.exist? self.path
if File.exists? self.path
File.open(self.path, 'r') do |file|
cached_credentials = JSON.load(file)
@authorization = Signet::OAuth2::Client.new(cached_credentials)

View File

@ -14,7 +14,7 @@
require 'addressable/uri'
require 'google/api_client/reference'
require 'uuidtools'
require 'securerandom'
module Google
class APIClient
@ -90,8 +90,7 @@ module Google
@global_callback = block if block_given?
@last_auto_id = 0
# TODO(sgomes): Use SecureRandom.uuid, drop UUIDTools when we drop 1.8
@base_id = UUIDTools::UUID.random_create.to_s
@base_id = SecureRandom.uuid
options[:uri] ||= 'https://www.googleapis.com/batch'
options[:http_method] ||= 'POST'

View File

@ -13,7 +13,6 @@
# limitations under the License.
require 'multi_json'
require 'compat/multi_json'
@ -63,7 +62,7 @@ module Google
end
while filename == nil
search_path ||= File.expand_path('.')
if File.exist?(File.join(search_path, 'client_secrets.json'))
if File.exists?(File.join(search_path, 'client_secrets.json'))
filename = File.join(search_path, 'client_secrets.json')
elsif search_path == '/' || search_path =~ /[a-zA-Z]:[\/\\]/
raise ArgumentError,

View File

@ -15,7 +15,7 @@
require 'addressable/uri'
require 'multi_json'
require 'google/inflection'
require 'active_support/inflector'
require 'google/api_client/discovery/resource'
require 'google/api_client/discovery/method'
require 'google/api_client/discovery/media'
@ -41,13 +41,13 @@ module Google
@discovery_document = discovery_document
metaclass = (class << self; self; end)
self.discovered_resources.each do |resource|
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
method_name = ActiveSupport::Inflector.underscore(resource.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) { resource }
end
end
self.discovered_methods.each do |method|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
method_name = ActiveSupport::Inflector.underscore(method.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) { method }
end

View File

@ -15,7 +15,7 @@
require 'addressable/uri'
require 'google/inflection'
require 'active_support/inflector'
require 'google/api_client/discovery/method'
@ -45,13 +45,13 @@ module Google
@discovery_document = discovery_document
metaclass = (class <<self; self; end)
self.discovered_resources.each do |resource|
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
method_name = ActiveSupport::Inflector.underscore(resource.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) { resource }
end
end
self.discovered_methods.each do |method|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
method_name = ActiveSupport::Inflector.underscore(method.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) { method }
end

View File

@ -21,7 +21,7 @@ require 'autoparse'
require 'addressable/uri'
require 'addressable/template'
require 'google/inflection'
require 'active_support/inflector'
require 'google/api_client/errors'
@ -78,10 +78,8 @@ module Google
# puts schema_data.inspect
if schema_name
api_name_string =
Google::INFLECTOR.camelize(api.name)
api_version_string =
Google::INFLECTOR.camelize(api.version).gsub('.', '_')
api_name_string = ActiveSupport::Inflector.camelize(api.name)
api_version_string = ActiveSupport::Inflector.camelize(api.version).gsub('.', '_')
# This is for compatibility with Ruby 1.8.7.
# TODO(bobaman) Remove this when we eventually stop supporting 1.8.7.
args = []

View File

@ -1,3 +1,4 @@
require 'rails/railtie'
require 'google/api_client/logging'
module Google
@ -9,7 +10,7 @@ module Google
#
class Railtie < Rails::Railtie
initializer 'google-api-client' do |app|
Google::APIClient.logger = Rails.logger
Google::APIClient.logger = app.logger
end
end
end

View File

@ -14,7 +14,6 @@
require 'faraday'
require 'faraday/request/multipart'
require 'multi_json'
require 'compat/multi_json'
require 'addressable/uri'
require 'stringio'

View File

@ -120,7 +120,7 @@ module Google
if options.include? :cache_store
@cache_store = options[:cache_store]
else
cache_exists = File.exist?(DEFAULT_CACHE_FILE)
cache_exists = File.exists?(DEFAULT_CACHE_FILE)
if (cache_exists && File.writable?(DEFAULT_CACHE_FILE)) ||
(!cache_exists && File.writable?(Dir.pwd))
@cache_store = Google::APIClient::Service::SimpleFileStore.new(

View File

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require 'active_support/inflector'
module Google
class APIClient
class Service
@ -25,7 +27,7 @@ module Google
# Handle resources.
root.discovered_resources.each do |resource|
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
method_name = ActiveSupport::Inflector.underscore(resource.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) do
Google::APIClient::Service::Resource.new(service, resource)
@ -35,7 +37,7 @@ module Google
# Handle methods.
root.discovered_methods.each do |method|
method_name = Google::INFLECTOR.underscore(method.name).to_sym
method_name = ActiveSupport::Inflector.underscore(method.name).to_sym
if !self.respond_to?(method_name)
metaclass.send(:define_method, method_name) do |*args|
if args.length > 1

View File

@ -13,19 +13,14 @@
# limitations under the License.
# Used to prevent the class/module from being loaded more than once
if !defined?(::Google::APIClient::VERSION)
module Google
class APIClient
module VERSION
MAJOR = 0
MINOR = 7
TINY = 1
PATCH = nil
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
end
module Google
class APIClient
module VERSION
MAJOR = 0
MINOR = 7
TINY = 1
PATCH = nil
STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
end
end
end

View File

@ -1,28 +0,0 @@
# 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
if defined?(ActiveSupport::Inflector)
INFLECTOR = ActiveSupport::Inflector
else
begin
require 'extlib/inflection'
INFLECTOR = Extlib::Inflection
rescue LoadError
require 'active_support/inflector'
INFLECTOR = ActiveSupport::Inflector
end
end
end

View File

@ -38,7 +38,7 @@ WIKI
output.gsub!(/-32\./, "-16.")
wiki_path = File.expand_path(
File.join(File.dirname(__FILE__), '../wiki/'))
Dir.mkdir(wiki_path) if !File.exist?(wiki_path)
Dir.mkdir(wiki_path) unless File.exists?(wiki_path)
File.open(File.join(wiki_path, 'SupportedAPIs.wiki'), 'w') do |file|
file.write(output)
end

View File

@ -14,9 +14,8 @@
require 'spec_helper'
require 'google/api_client'
require 'google/api_client/version'
describe Google::APIClient::BatchRequest do
RSpec.describe Google::APIClient::BatchRequest do
CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT)
after do

View File

@ -22,9 +22,8 @@ require 'multi_json'
require 'compat/multi_json'
require 'signet/oauth_1/client'
require 'google/api_client'
require 'google/api_client/version'
describe Google::APIClient do
RSpec.describe Google::APIClient do
include ConnectionHelpers
CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT)

View File

@ -15,9 +15,8 @@
require 'spec_helper'
require 'google/api_client'
require 'google/api_client/version'
describe Google::APIClient::Gzip do
RSpec.describe Google::APIClient::Gzip do
def create_connection(&block)
Faraday.new do |b|

View File

@ -15,11 +15,10 @@
require 'spec_helper'
require 'google/api_client'
require 'google/api_client/version'
fixtures_path = File.expand_path('../../../fixtures', __FILE__)
describe Google::APIClient::UploadIO do
RSpec.describe Google::APIClient::UploadIO do
it 'should reject invalid file paths' do
expect(lambda do
media = Google::APIClient::UploadIO.new('doesnotexist', 'text/plain')
@ -57,7 +56,7 @@ describe Google::APIClient::UploadIO do
end
end
describe Google::APIClient::RangedIO do
RSpec.describe Google::APIClient::RangedIO do
before do
@source = StringIO.new("1234567890abcdef")
@io = Google::APIClient::RangedIO.new(@source, 1, 5)
@ -105,7 +104,7 @@ describe Google::APIClient::RangedIO do
end
describe Google::APIClient::ResumableUpload do
RSpec.describe Google::APIClient::ResumableUpload do
CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT)
after do

View File

@ -15,9 +15,8 @@
require 'spec_helper'
require 'google/api_client'
require 'google/api_client/version'
describe Google::APIClient::Request do
RSpec.describe Google::APIClient::Request do
CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT)
it 'should normalize parameter names to strings' do

View File

@ -15,9 +15,8 @@
require 'spec_helper'
require 'google/api_client'
require 'google/api_client/version'
describe Google::APIClient::Result do
RSpec.describe Google::APIClient::Result do
CLIENT = Google::APIClient.new(:application_name => 'API Client Tests') unless defined?(CLIENT)
describe 'with the plus API' do

View File

@ -18,7 +18,7 @@ require 'google/api_client'
fixtures_path = File.expand_path('../../../fixtures', __FILE__)
describe Google::APIClient::KeyUtils do
RSpec.describe Google::APIClient::KeyUtils do
it 'should read PKCS12 files from the filesystem' do
if RUBY_PLATFORM == 'java' && RUBY_VERSION.start_with?('1.8')
pending "Reading from PKCS12 not supported on jruby 1.8.x"
@ -53,7 +53,7 @@ describe Google::APIClient::KeyUtils do
end
describe Google::APIClient::JWTAsserter do
RSpec.describe Google::APIClient::JWTAsserter do
include ConnectionHelpers
before do
@ -146,7 +146,7 @@ describe Google::APIClient::JWTAsserter do
end
end
describe Google::APIClient::ComputeServiceAccount do
RSpec.describe Google::APIClient::ComputeServiceAccount do
include ConnectionHelpers
it 'should query metadata server' do

View File

@ -21,7 +21,7 @@ require 'google/api_client/service'
fixtures_path = File.expand_path('../../../fixtures', __FILE__)
describe Google::APIClient::Service do
RSpec.describe Google::APIClient::Service do
include ConnectionHelpers
APPLICATION_NAME = 'API Client Tests'
@ -288,7 +288,7 @@ describe Google::APIClient::Service do
end
describe Google::APIClient::Service::Result do
RSpec.describe Google::APIClient::Service::Result do
describe 'with the plus API' do
before do
@ -492,7 +492,7 @@ describe Google::APIClient::Service::Result do
end
end
describe Google::APIClient::Service::BatchRequest do
RSpec.describe Google::APIClient::Service::BatchRequest do
describe 'with the discovery API' do
before do
@discovery = Google::APIClient::Service.new('discovery', 'v1',

View File

@ -18,14 +18,10 @@ require 'spec_helper'
require 'google/api_client/service/simple_file_store'
describe Google::APIClient::Service::SimpleFileStore do
RSpec.describe Google::APIClient::Service::SimpleFileStore do
FILE_NAME = 'test.cache'
before(:all) do
File.delete(FILE_NAME) if File.exists?(FILE_NAME)
end
describe 'with no cache file' do
before(:each) do
File.delete(FILE_NAME) if File.exists?(FILE_NAME)

View File

@ -17,7 +17,6 @@ require 'spec_helper'
require 'faraday'
require 'signet/oauth_1/client'
require 'google/api_client'
require 'google/api_client/version'
shared_examples_for 'configurable user agent' do
include ConnectionHelpers
@ -55,7 +54,7 @@ shared_examples_for 'configurable user agent' do
end
end
describe Google::APIClient do
RSpec.describe Google::APIClient do
include ConnectionHelpers
let(:client) { Google::APIClient.new(:application_name => 'API Client Tests') }
@ -191,7 +190,7 @@ describe Google::APIClient do
end
client.execute(
:uri => 'https://www.gogole.com/foo',
:uri => 'https://www.google.com/foo',
:connection => @connection
)
end
@ -210,7 +209,7 @@ describe Google::APIClient do
end
client.execute(
:uri => 'https://www.gogole.com/foo',
:uri => 'https://www.google.com/foo',
:connection => @connection
)
end
@ -227,7 +226,7 @@ describe Google::APIClient do
end
client.execute(
:uri => 'https://www.gogole.com/foo',
:uri => 'https://www.google.com/foo',
:connection => @connection
)
end
@ -243,7 +242,7 @@ describe Google::APIClient do
end
client.execute(
:uri => 'https://www.gogole.com/foo',
:uri => 'https://www.google.com/foo',
:connection => @connection,
:authenticated => false
)
@ -262,7 +261,7 @@ describe Google::APIClient do
end
expect(client.execute(
:uri => 'https://www.gogole.com/foo',
:uri => 'https://www.google.com/foo',
:connection => @connection
).status).to eq(200)
@ -279,7 +278,7 @@ describe Google::APIClient do
end
expect(client.execute(
:uri => 'https://www.gogole.com/foo',
:uri => 'https://www.google.com/foo',
:connection => @connection
).status).to eq(500)
expect(count).to eq(3)