Use ActiveSupport instead of extlib
This commit is contained in:
parent
9719c9f357
commit
b2343e24a5
|
@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|||
s.add_runtime_dependency('autoparse', '>= 0.3.3')
|
||||
s.add_runtime_dependency('faraday', '>= 0.9.0')
|
||||
s.add_runtime_dependency('multi_json', '>= 1.0.0')
|
||||
s.add_runtime_dependency('extlib', '>= 0.9.15')
|
||||
s.add_runtime_dependency('activesupport', '>= 3.2.0')
|
||||
s.add_runtime_dependency('jwt', '>= 0.1.5')
|
||||
s.add_runtime_dependency('retriable', '~> 1.4')
|
||||
s.add_runtime_dependency('launchy', '>= 2.1.1')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,24 +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
|
||||
begin
|
||||
require 'active_support/inflector'
|
||||
INFLECTOR = ActiveSupport::Inflector
|
||||
rescue LoadError
|
||||
require 'extlib/inflection'
|
||||
INFLECTOR = Extlib::Inflection
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue