{"action":"created","issue":{"url":"https://api.github.com/repos/recurly/recurly-client-ruby/issues/241","repository_url":"https://api.github.com/repos/recurly/recurly-client-ruby","labels_url":"https://api.github.com/repos/recurly/recurly-client-ruby/issues/241/labels{/name}","comments_url":"https://api.github.com/repos/recurly/recurly-client-ruby/issues/241/comments","events_url":"https://api.github.com/repos/recurly/recurly-client-ruby/issues/241/events","html_url":"https://github.com/recurly/recurly-client-ruby/issues/241","id":152889679,"number":241,"title":"issue with trying to update the unit_price_in_cents for a subscription","user":{"login":"rloomba","id":2114180,"avatar_url":"https://avatars.githubusercontent.com/u/2114180?v=3","gravatar_id":"","url":"https://api.github.com/users/rloomba","html_url":"https://github.com/rloomba","followers_url":"https://api.github.com/users/rloomba/followers","following_url":"https://api.github.com/users/rloomba/following{/other_user}","gists_url":"https://api.github.com/users/rloomba/gists{/gist_id}","starred_url":"https://api.github.com/users/rloomba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rloomba/subscriptions","organizations_url":"https://api.github.com/users/rloomba/orgs","repos_url":"https://api.github.com/users/rloomba/repos","events_url":"https://api.github.com/users/rloomba/events{/privacy}","received_events_url":"https://api.github.com/users/rloomba/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/recurly/recurly-client-ruby/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"bhelx","id":185919,"avatar_url":"https://avatars.githubusercontent.com/u/185919?v=3","gravatar_id":"","url":"https://api.github.com/users/bhelx","html_url":"https://github.com/bhelx","followers_url":"https://api.github.com/users/bhelx/followers","following_url":"https://api.github.com/users/bhelx/following{/other_user}","gists_url":"https://api.github.com/users/bhelx/gists{/gist_id}","starred_url":"https://api.github.com/users/bhelx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhelx/subscriptions","organizations_url":"https://api.github.com/users/bhelx/orgs","repos_url":"https://api.github.com/users/bhelx/repos","events_url":"https://api.github.com/users/bhelx/events{/privacy}","received_events_url":"https://api.github.com/users/bhelx/received_events","type":"User","site_admin":false},"milestone":null,"comments":10,"created_at":"2016-05-03T22:33:17Z","updated_at":"2016-05-04T17:20:15Z","closed_at":null,"body":"I'm running into an issue when I try to update the `unit_price_in_cents` attribute for one of my subscriptions. Here's the code I'm using to update the subscription. I'm manually overriding the plan's `unit_price_in_cents` with the update, however it doesn't seem to be properly updating. When I check the `pending_subscription`, the old `unit_price_in_cents` shows.\r\n\r\n```ruby\r\nsubscription.update_attributes(\r\n      plan_code: plan_code,\r\n      quantity: new_quantity,\r\n      timeframe: 'renewal',\r\n      subscription_add_ons: [shipping_add_on],\r\n      unit_amount_in_cents: unit_amount_in_cents\r\n    )\r\n```\r\n\r\nHere's a log printout of the PUT request.\r\n\r\n```\r\nPUT https://sg-test.recurly.com/v2/subscriptions/35e779a128456c19cc9cb34d79876aad\r\n{\"accept\"=>[\"application/xml\"], \"user-agent\"=>[\"Recurly/2.4.8; ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]\"], \"x-api-version\"=>[\"2.1\"], \"accept-language\"=>[\"en-US,en;q=0.8\"], \"accept-encoding\"=>[\"gzip;q=1.0,deflate;q=0.6,identity;q=0.3\"], \"authorization\"=>[\"Basic [FILTERED]\"], \"content-type\"=>[\"application/xml\"]}\r\n<subscription><plan_code>sv-7</plan_code><subscription_add_ons><subscription_add_on><add_on_code>sv-7-shipping</add_on_code><unit_amount_in_cents>500</unit_amount_in_cents></subscription_add_on></subscription_add_ons><timeframe>renewal</timeframe></subscription>\r\n```\r\n\r\nI think what's happening is the `unit_amount_in_cents` field isn't changing, so so the [xml_keys](https://github.com/recurly/recurly-client-ruby/blob/master/lib/recurly/resource.rb#L1047) method is excluding it from the PUT request. When the subscription updates on the backend, it defaults to the plan's `unit_price_in_cents`, which is wrong. Any ideas on how I can fix this for my use case?"},"comment":{"url":"https://api.github.com/repos/recurly/recurly-client-ruby/issues/comments/216937922","html_url":"https://github.com/recurly/recurly-client-ruby/issues/241#issuecomment-216937922","issue_url":"https://api.github.com/repos/recurly/recurly-client-ruby/issues/241","id":216937922,"user":{"login":"bhelx","id":185919,"avatar_url":"https://avatars.githubusercontent.com/u/185919?v=3","gravatar_id":"","url":"https://api.github.com/users/bhelx","html_url":"https://github.com/bhelx","followers_url":"https://api.github.com/users/bhelx/followers","following_url":"https://api.github.com/users/bhelx/following{/other_user}","gists_url":"https://api.github.com/users/bhelx/gists{/gist_id}","starred_url":"https://api.github.com/users/bhelx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhelx/subscriptions","organizations_url":"https://api.github.com/users/bhelx/orgs","repos_url":"https://api.github.com/users/bhelx/repos","events_url":"https://api.github.com/users/bhelx/events{/privacy}","received_events_url":"https://api.github.com/users/bhelx/received_events","type":"User","site_admin":false},"created_at":"2016-05-04T17:20:15Z","updated_at":"2016-05-04T17:20:15Z","body":"Sorry, I'm realizing that is an attribute for the SubscriptionChange and not the Subscription. The `update_attributes` was implicitly creating a SubscriptionChange (which this library does not have a model for). \r\n\r\nI'll take a few minutes to work out the underlying issue and report back."}}