This affects all requests to all resources. The problem is with pre_query variable in closure which gets overwritten after calling any of the resource methods.
DEFINITIONS[resource_name].each do |method_name, url|
parts = url.split("?")
pre_query = parts[0]
#^^^^^^^^
post_query = parts[1]
singleton.send :define_method, "_#{method_name}" do |*args|
pre_query = Digitalocean.process_standard_args_from_part(pre_query, args)
#^^^^^^^^ ^^^^^^^^^
post_query = Digitalocean.process_hash_args_from_part(post_query, args)
[pre_query, post_query].join("?")
end
# ...
end
Example:
This affects all requests to all resources. The problem is with
pre_query
variable in closure which gets overwritten after calling any of the resource methods.