Use ActiveSupport instead of extlib

This commit is contained in:
Abdelkader Boudih committed 2014-10-08 12:03:28 +00:00
1 parent 9719c9f357
commit b2343e24a5
6 files changed
+14 -38

No files matched your search

+3 -3
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
+3 -3
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
+3 -5
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 = []
@@ -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