Use ActiveSupport instead of extlib
authorAbdelkader Boudih <terminale@gmail.com>
Thu, 18 Sep 2014 18:15:10 +0000 (18:15 +0000)
committerAbdelkader Boudih <terminale@gmail.com>
Wed, 8 Oct 2014 12:03:28 +0000 (12:03 +0000)
google-api-client.gemspec
lib/google/api_client/discovery/api.rb
lib/google/api_client/discovery/resource.rb
lib/google/api_client/discovery/schema.rb
lib/google/api_client/service/stub_generator.rb
lib/google/inflection.rb [deleted file]

index cced2ec635c75553754fe17ff1a509244342f2fe..39cea1eca5f994c7e180af3636f505a8994669a5 100644 (file)
@@ -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')
index 4c58d7e1044ae23551976bbdd60b3d56328bfb91..be83f6279fdb2765f774bff8e9f2a39c60d762d4 100644 (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
index f6493ff40c8a38c627ee07792ed256e07afe5ced..9b757c684da02aed78a8905e1a8ea0d22fbc3e85 100644 (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
index 34755190f4e3f8c8b6bad8b4e6da3ff8cdfce085..557887ca2edfdaf3aad6585751c5f9158f38d3ce 100644 (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 = []
index 37fdc810cd232a794b2ae6128408d81851f61810..3c84dddbd2e97313b81b96180b77038257311881 100755 (executable)
@@ -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
diff --git a/lib/google/inflection.rb b/lib/google/inflection.rb
deleted file mode 100644 (file)
index 127a6d4..0000000
+++ /dev/null
@@ -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