lib/recurly/resource.rb in recurly-2.0.11 vs lib/recurly/resource.rb in recurly-2.0.12
- old
+ new
@@ -1,6 +1,7 @@
require 'date'
+require 'erb'
module Recurly
# The base class for all Recurly resources (e.g. {Account}, {Subscription},
# {Transaction}).
#
@@ -181,10 +182,11 @@
# @param uuid [String, nil]
# @example
# Recurly::Account.member_path "code" # => "accounts/code"
# Recurly::Account.member_path nil # => "accounts"
def member_path uuid
+ uuid = ERB::Util.url_encode(uuid) if uuid
[collection_path, uuid].compact.join '/'
end
# @return [Array] Per attribute, defines readers, writers, boolean and
# change-tracking methods.
@@ -317,12 +319,11 @@
request_options = {}
if etag = options[:etag]
request_options[:head] = { 'If-None-Match' => etag }
end
- uri = uuid =~ /^http/ ? uuid : member_path(uuid)
begin
- from_response API.get(uri, {}, request_options)
+ from_response API.get(member_path(uuid), {}, options)
rescue API::NotFound => e
raise NotFound, e.description
end
end