lib/billys_billing/client.rb in billysbilling-rails-1.1.0 vs lib/billys_billing/client.rb in billysbilling-rails-1.1.1
- old
+ new
@@ -26,12 +26,12 @@
end
end
def method_missing(method, *arguments, &block)
# the first argument is a Symbol, so you need to_s it if you want to pattern match
- if method.to_s =~ /^(#{valid_actions.join("|")})_(#{valid_queries.join("s?|")})(!?)/ && respond_to?($1)
- send("#{$1}#{$3}", *[$2.pluralize].concat(arguments), &block)
+ if method.to_s =~ /^(#{valid_actions.join("|")})_(#{valid_queries.join("s?|")})(!?)/
+ send("#{$1}#{$3}", *[$2.billyfy].concat(arguments), &block)
else
super
end
end
@@ -80,14 +80,13 @@
alias_method :find, :show
alias_method :get, :show
def index(class_name, params={}, options={})
params = {q: params} if params.is_a?(String)
-
list = []
response = get_request("/#{class_name}", params, options)
if response.success?
- response[class_name].each do |instance|
+ response[class_name.rubyify].each do |instance|
list << get_class_instance(class_name, instance)
end
return list
else
options[:return_error_message] ? response["error"] : false
\ No newline at end of file