Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix partial address update bug #315

Merged
merged 1 commit into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/recurly/address.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Recurly
class Address < Resource

define_attribute_methods %w(
address1
address2
Expand All @@ -11,5 +10,12 @@ class Address < Resource
phone
geo_code
)

# This ensures every attribute is rendered
# when updating. The Address object does not
# accept partial updates on the server
def xml_keys
attributes.keys
end
end
end
4 changes: 2 additions & 2 deletions lib/recurly/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ def from_xml(xml)
# parsing here or else it always serializes. Need
# a better way of handling changed attributes
if el.name == 'address' && val.kind_of?(Hash)
address = Address.new val
address.changed_attributes.clear
address = Address.new(val)
address.instance_variable_set(:@changed_attributes, {})
record[el.name] = address
else
record[el.name] = val
Expand Down