lib/recurly/resource.rb in recurly-2.8.0.rc3 vs lib/recurly/resource.rb in recurly-2.8.0

- old
+ new

@@ -330,12 +330,11 @@ # for plans use plan_code # for invoices use invoice_number # for subscriptions use uuid # for transactions use uuid def find(uuid, options = {}) - if uuid.nil? - # Should we raise an ArgumentError, instead? + if uuid.nil? || uuid.to_s.empty? raise NotFound, "can't find a record with nil identifier" end uri = uuid =~ /^http/ ? uuid : member_path(uuid) begin @@ -410,9 +409,12 @@ xml.root.attributes.each do |name, value| record.instance_variable_set "@#{name}", value.to_s end xml.each_element do |el| + # skip this element if it's an xml comment + next if defined?(Nokogiri::XML::Node::TEXT_NODE) && el.is_a?(Nokogiri::XML::Comment) + if el.name == 'a' record.links[el.attribute('name').value] = { :method => el.attribute('method').to_s, :href => el.attribute('href').value }