Skip to content

Commit d6d8ec7

Browse files
committed
Merge branch 'seuros-more'
2 parents 7ac37a5 + f8ca44f commit d6d8ec7

26 files changed

+54
-106
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
language: ruby
22
rvm:
3-
- 1.8.7
4-
- 1.9.2
53
- 1.9.3
64
- 2.0.0
75
- 2.1.0
86
- rbx-2
9-
- jruby-18mode
107
- jruby-19mode
11-
- ree
128
script: "bundle exec rake spec:all"
139
before_install:
1410
- sudo apt-get update

google-api-client.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ Gem::Specification.new do |s|
2626
s.add_runtime_dependency 'signet', '~> 0.6'
2727
s.add_runtime_dependency 'faraday', '~> 0.9'
2828
s.add_runtime_dependency 'multi_json', '~> 1.10'
29-
s.add_runtime_dependency 'uuidtools', "~> 2.1"
3029
s.add_runtime_dependency 'autoparse', "~> 0.3"
3130
s.add_runtime_dependency 'extlib', '~> 0.9'
3231
s.add_runtime_dependency 'launchy', '~> 2.4'
3332
s.add_runtime_dependency 'retriable', '~> 1.4'
34-
33+
s.add_runtime_dependency 'activesupport', '~> 3.2'
34+
3535
s.add_development_dependency 'rake', '~> 10.0'
3636
s.add_development_dependency 'yard', '~> 0.8'
3737
s.add_development_dependency 'rspec', '~> 3.1'

lib/google/api_client.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
require 'google/api_client/batch'
3333
require 'google/api_client/gzip'
3434
require 'google/api_client/client_secrets'
35-
require 'google/api_client/railtie' if defined?(Rails::Railtie)
35+
require 'google/api_client/railtie' if defined?(Rails)
3636

3737
module Google
3838

@@ -692,5 +692,3 @@ def client_error_handler(authorization)
692692
end
693693

694694
end
695-
696-
require 'google/api_client/version'

lib/google/api_client/auth/file_storage.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def initialize(path)
4242
##
4343
# Attempt to read in credentials from the specified file.
4444
def load_credentials
45-
if File.exist? self.path
45+
if File.exists? self.path
4646
File.open(self.path, 'r') do |file|
4747
cached_credentials = JSON.load(file)
4848
@authorization = Signet::OAuth2::Client.new(cached_credentials)

lib/google/api_client/batch.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
require 'addressable/uri'
1616
require 'google/api_client/reference'
17-
require 'uuidtools'
17+
require 'securerandom'
1818

1919
module Google
2020
class APIClient
@@ -90,8 +90,7 @@ def initialize(options = {}, &block)
9090
@global_callback = block if block_given?
9191
@last_auto_id = 0
9292

93-
# TODO(sgomes): Use SecureRandom.uuid, drop UUIDTools when we drop 1.8
94-
@base_id = UUIDTools::UUID.random_create.to_s
93+
@base_id = SecureRandom.uuid
9594

9695
options[:uri] ||= 'https://www.googleapis.com/batch'
9796
options[:http_method] ||= 'POST'

lib/google/api_client/client_secrets.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515

16-
require 'multi_json'
1716
require 'compat/multi_json'
1817

1918

@@ -63,7 +62,7 @@ def self.load(filename=nil)
6362
end
6463
while filename == nil
6564
search_path ||= File.expand_path('.')
66-
if File.exist?(File.join(search_path, 'client_secrets.json'))
65+
if File.exists?(File.join(search_path, 'client_secrets.json'))
6766
filename = File.join(search_path, 'client_secrets.json')
6867
elsif search_path == '/' || search_path =~ /[a-zA-Z]:[\/\\]/
6968
raise ArgumentError,

lib/google/api_client/discovery/api.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
require 'addressable/uri'
1717
require 'multi_json'
18-
require 'google/inflection'
18+
require 'active_support/inflector'
1919
require 'google/api_client/discovery/resource'
2020
require 'google/api_client/discovery/method'
2121
require 'google/api_client/discovery/media'
@@ -41,13 +41,13 @@ def initialize(document_base, discovery_document)
4141
@discovery_document = discovery_document
4242
metaclass = (class << self; self; end)
4343
self.discovered_resources.each do |resource|
44-
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
44+
method_name = ActiveSupport::Inflector.underscore(resource.name).to_sym
4545
if !self.respond_to?(method_name)
4646
metaclass.send(:define_method, method_name) { resource }
4747
end
4848
end
4949
self.discovered_methods.each do |method|
50-
method_name = Google::INFLECTOR.underscore(method.name).to_sym
50+
method_name = ActiveSupport::Inflector.underscore(method.name).to_sym
5151
if !self.respond_to?(method_name)
5252
metaclass.send(:define_method, method_name) { method }
5353
end

lib/google/api_client/discovery/resource.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
require 'addressable/uri'
1717

18-
require 'google/inflection'
18+
require 'active_support/inflector'
1919
require 'google/api_client/discovery/method'
2020

2121

@@ -45,13 +45,13 @@ def initialize(api, method_base, resource_name, discovery_document)
4545
@discovery_document = discovery_document
4646
metaclass = (class <<self; self; end)
4747
self.discovered_resources.each do |resource|
48-
method_name = Google::INFLECTOR.underscore(resource.name).to_sym
48+
method_name = ActiveSupport::Inflector.underscore(resource.name).to_sym
4949
if !self.respond_to?(method_name)
5050
metaclass.send(:define_method, method_name) { resource }
5151
end
5252
end
5353
self.discovered_methods.each do |method|
54-
method_name = Google::INFLECTOR.underscore(method.name).to_sym
54+
method_name = ActiveSupport::Inflector.underscore(method.name).to_sym
5555
if !self.respond_to?(method_name)
5656
metaclass.send(:define_method, method_name) { method }
5757
end

lib/google/api_client/discovery/schema.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
require 'addressable/uri'
2222
require 'addressable/template'
2323

24-
require 'google/inflection'
24+
require 'active_support/inflector'
2525
require 'google/api_client/errors'
2626

2727

@@ -78,10 +78,8 @@ def self.parse(api, schema_data)
7878
# puts schema_data.inspect
7979

8080
if schema_name
81-
api_name_string =
82-
Google::INFLECTOR.camelize(api.name)
83-
api_version_string =
84-
Google::INFLECTOR.camelize(api.version).gsub('.', '_')
81+
api_name_string = ActiveSupport::Inflector.camelize(api.name)
82+
api_version_string = ActiveSupport::Inflector.camelize(api.version).gsub('.', '_')
8583
# This is for compatibility with Ruby 1.8.7.
8684
# TODO(bobaman) Remove this when we eventually stop supporting 1.8.7.
8785
args = []

lib/google/api_client/railtie.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'rails/railtie'
12
require 'google/api_client/logging'
23

34
module Google
@@ -9,7 +10,7 @@ class APIClient
910
#
1011
class Railtie < Rails::Railtie
1112
initializer 'google-api-client' do |app|
12-
Google::APIClient.logger = Rails.logger
13+
Google::APIClient.logger = app.logger
1314
end
1415
end
1516
end

0 commit comments

Comments
 (0)