lib/redbooth-ruby/request/collection.rb in redbooth-ruby-0.0.5 vs lib/redbooth-ruby/request/collection.rb in redbooth-ruby-0.1.0
- old
+ new
@@ -1,8 +1,9 @@
module RedboothRuby
module Request
class Collection
+ include RedboothRuby::Helpers
attr_reader :response, :params, :method, :session, :resource
def initialize(attributes={})
@response = attributes[:response]
@params = attributes[:params]
@@ -97,15 +98,15 @@
klass = resource_klass(klass_name)
return unless klass
klass.new(hash)
end
- # Gest the api resource model class by his name
+ # Get the api resource model class by his name
#
# @param [String||Symbol] name name of the resource
# @return [Copy::Base] resource to use the api
def resource_klass(name)
- eval('RedboothRuby::' + name.to_s.capitalize) rescue nil
+ eval('RedboothRuby::' + camelize(name)) rescue nil
end
# Whenever the response is paginated or not
def paginated?
return false unless current_page