{"action":"created","comment":{"url":"https://api.github.com/repos/fog/fog-dynect/pulls/comments/56231355","id":56231355,"diff_hunk":"@@ -25,7 +25,9 @@ def save(replace=false)\n           }\n           options.delete_if {|key, value| value.nil?}\n \n-          if replace\n+          refresh_id if replace && identity.nil?\n+          if replace && !identity.nil?","path":"lib/fog/dynect/models/dns/record.rb","position":6,"original_position":6,"commit_id":"082af4959ae1f6675d0e2d5def36ed768ea5e061","original_commit_id":"082af4959ae1f6675d0e2d5def36ed768ea5e061","user":{"login":"a13m","id":903335,"avatar_url":"https://avatars.githubusercontent.com/u/903335?v=3","gravatar_id":"","url":"https://api.github.com/users/a13m","html_url":"https://github.com/a13m","followers_url":"https://api.github.com/users/a13m/followers","following_url":"https://api.github.com/users/a13m/following{/other_user}","gists_url":"https://api.github.com/users/a13m/gists{/gist_id}","starred_url":"https://api.github.com/users/a13m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a13m/subscriptions","organizations_url":"https://api.github.com/users/a13m/orgs","repos_url":"https://api.github.com/users/a13m/repos","events_url":"https://api.github.com/users/a13m/events{/privacy}","received_events_url":"https://api.github.com/users/a13m/received_events","type":"User","site_admin":false},"body":"The else block at line 32 is executed under different conditions than refresh_id, so it would have to be something like:\r\n\r\n```\r\nif replace\r\n  if identity.nil?\r\n    refresh_id\r\n    data = service.post_record(type, zone.identity, name, rdata, options).body['data']\r\n  else\r\n    options['record_id'] = identity\r\n    data = service.put_record(type, zone.identity, name, rdata, options).body['data']\r\n  end\r\nelse\r\n  data = service.post_record(type, zone.identity, name, rdata, options).body['data']\r\nend\r\n```\r\n\r\nIf you think that is more clear, then I can change it, but I really did not want to duplicate the post_record call.","created_at":"2016-03-15T20:07:29Z","updated_at":"2016-03-15T20:07:29Z","html_url":"https://github.com/fog/fog-dynect/pull/3#discussion_r56231355","pull_request_url":"https://api.github.com/repos/fog/fog-dynect/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/fog/fog-dynect/pulls/comments/56231355"},"html":{"href":"https://github.com/fog/fog-dynect/pull/3#discussion_r56231355"},"pull_request":{"href":"https://api.github.com/repos/fog/fog-dynect/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/fog/fog-dynect/pulls/3","id":45198826,"html_url":"https://github.com/fog/fog-dynect/pull/3","diff_url":"https://github.com/fog/fog-dynect/pull/3.diff","patch_url":"https://github.com/fog/fog-dynect/pull/3.patch","issue_url":"https://api.github.com/repos/fog/fog-dynect/issues/3","number":3,"state":"open","locked":false,"title":"Fix DNS record updates for fog-core 1.25.0 and later","user":{"login":"a13m","id":903335,"avatar_url":"https://avatars.githubusercontent.com/u/903335?v=3","gravatar_id":"","url":"https://api.github.com/users/a13m","html_url":"https://github.com/a13m","followers_url":"https://api.github.com/users/a13m/followers","following_url":"https://api.github.com/users/a13m/following{/other_user}","gists_url":"https://api.github.com/users/a13m/gists{/gist_id}","starred_url":"https://api.github.com/users/a13m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a13m/subscriptions","organizations_url":"https://api.github.com/users/a13m/orgs","repos_url":"https://api.github.com/users/a13m/repos","events_url":"https://api.github.com/users/a13m/events{/privacy}","received_events_url":"https://api.github.com/users/a13m/received_events","type":"User","site_admin":false},"body":"When PUT is called for a Dynect CNAME record without specifying\r\na record_id, the response contains an array of records.  The\r\noriginal code for supporting CNAME updates assumed that a\r\nsingle record would be returned.  In fog-core prior to 1.25.0,\r\nmerge_attributes was quietly mishandling this data without\r\nraising an exception.  Starting with version 1.25.0, the use\r\nof 'each_pair' to iterate the hash caused an exception to be\r\nraised when an array was passed instead.\r\n\r\nThis change fixes PUT calls by first retrieving the existing\r\nrecord and performing the update on the correct record_id.","created_at":"2015-09-16T17:12:51Z","updated_at":"2016-03-15T20:07:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef917da431b83317c2d327558c0d0e8837c26c69","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fog/fog-dynect/pulls/3/commits","review_comments_url":"https://api.github.com/repos/fog/fog-dynect/pulls/3/comments","review_comment_url":"https://api.github.com/repos/fog/fog-dynect/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fog/fog-dynect/issues/3/comments","statuses_url":"https://api.github.com/repos/fog/fog-dynect/statuses/082af4959ae1f6675d0e2d5def36ed768ea5e061","head":{"label":"a13m:put_record","ref":"put_record","sha":"082af4959ae1f6675d0e2d5def36ed768ea5e061","user":{"login":"a13m","id":903335,"avatar_url":"https://avatars.githubusercontent.com/u/903335?v=3","gravatar_id":"","url":"https://api.github.com/users/a13m","html_url":"https://github.com/a13m","followers_url":"https://api.github.com/users/a13m/followers","following_url":"https://api.github.com/users/a13m/following{/other_user}","gists_url":"https://api.github.com/users/a13m/gists{/gist_id}","starred_url":"https://api.github.com/users/a13m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a13m/subscriptions","organizations_url":"https://api.github.com/users/a13m/orgs","repos_url":"https://api.github.com/users/a13m/repos","events_url":"https://api.github.com/users/a13m/events{/privacy}","received_events_url":"https://api.github.com/users/a13m/received_events","type":"User","site_admin":false},"repo":{"id":42598022,"name":"fog-dynect","full_name":"a13m/fog-dynect","owner":{"login":"a13m","id":903335,"avatar_url":"https://avatars.githubusercontent.com/u/903335?v=3","gravatar_id":"","url":"https://api.github.com/users/a13m","html_url":"https://github.com/a13m","followers_url":"https://api.github.com/users/a13m/followers","following_url":"https://api.github.com/users/a13m/following{/other_user}","gists_url":"https://api.github.com/users/a13m/gists{/gist_id}","starred_url":"https://api.github.com/users/a13m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a13m/subscriptions","organizations_url":"https://api.github.com/users/a13m/orgs","repos_url":"https://api.github.com/users/a13m/repos","events_url":"https://api.github.com/users/a13m/events{/privacy}","received_events_url":"https://api.github.com/users/a13m/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/a13m/fog-dynect","description":"Module for the 'fog' gem to support Dyn Managed DNS http://dyn.com/","fork":true,"url":"https://api.github.com/repos/a13m/fog-dynect","forks_url":"https://api.github.com/repos/a13m/fog-dynect/forks","keys_url":"https://api.github.com/repos/a13m/fog-dynect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/a13m/fog-dynect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/a13m/fog-dynect/teams","hooks_url":"https://api.github.com/repos/a13m/fog-dynect/hooks","issue_events_url":"https://api.github.com/repos/a13m/fog-dynect/issues/events{/number}","events_url":"https://api.github.com/repos/a13m/fog-dynect/events","assignees_url":"https://api.github.com/repos/a13m/fog-dynect/assignees{/user}","branches_url":"https://api.github.com/repos/a13m/fog-dynect/branches{/branch}","tags_url":"https://api.github.com/repos/a13m/fog-dynect/tags","blobs_url":"https://api.github.com/repos/a13m/fog-dynect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/a13m/fog-dynect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/a13m/fog-dynect/git/refs{/sha}","trees_url":"https://api.github.com/repos/a13m/fog-dynect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/a13m/fog-dynect/statuses/{sha}","languages_url":"https://api.github.com/repos/a13m/fog-dynect/languages","stargazers_url":"https://api.github.com/repos/a13m/fog-dynect/stargazers","contributors_url":"https://api.github.com/repos/a13m/fog-dynect/contributors","subscribers_url":"https://api.github.com/repos/a13m/fog-dynect/subscribers","subscription_url":"https://api.github.com/repos/a13m/fog-dynect/subscription","commits_url":"https://api.github.com/repos/a13m/fog-dynect/commits{/sha}","git_commits_url":"https://api.github.com/repos/a13m/fog-dynect/git/commits{/sha}","comments_url":"https://api.github.com/repos/a13m/fog-dynect/comments{/number}","issue_comment_url":"https://api.github.com/repos/a13m/fog-dynect/issues/comments{/number}","contents_url":"https://api.github.com/repos/a13m/fog-dynect/contents/{+path}","compare_url":"https://api.github.com/repos/a13m/fog-dynect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/a13m/fog-dynect/merges","archive_url":"https://api.github.com/repos/a13m/fog-dynect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/a13m/fog-dynect/downloads","issues_url":"https://api.github.com/repos/a13m/fog-dynect/issues{/number}","pulls_url":"https://api.github.com/repos/a13m/fog-dynect/pulls{/number}","milestones_url":"https://api.github.com/repos/a13m/fog-dynect/milestones{/number}","notifications_url":"https://api.github.com/repos/a13m/fog-dynect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/a13m/fog-dynect/labels{/name}","releases_url":"https://api.github.com/repos/a13m/fog-dynect/releases{/id}","deployments_url":"https://api.github.com/repos/a13m/fog-dynect/deployments","created_at":"2015-09-16T16:05:10Z","updated_at":"2015-09-16T16:05:11Z","pushed_at":"2015-09-16T17:11:42Z","git_url":"git://github.com/a13m/fog-dynect.git","ssh_url":"git@github.com:a13m/fog-dynect.git","clone_url":"https://github.com/a13m/fog-dynect.git","svn_url":"https://github.com/a13m/fog-dynect","homepage":null,"size":243,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fog:master","ref":"master","sha":"2e94f6ffcaddc5eb2b3d771763b8dffb56ee3677","user":{"login":"fog","id":991149,"avatar_url":"https://avatars.githubusercontent.com/u/991149?v=3","gravatar_id":"","url":"https://api.github.com/users/fog","html_url":"https://github.com/fog","followers_url":"https://api.github.com/users/fog/followers","following_url":"https://api.github.com/users/fog/following{/other_user}","gists_url":"https://api.github.com/users/fog/gists{/gist_id}","starred_url":"https://api.github.com/users/fog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fog/subscriptions","organizations_url":"https://api.github.com/users/fog/orgs","repos_url":"https://api.github.com/users/fog/repos","events_url":"https://api.github.com/users/fog/events{/privacy}","received_events_url":"https://api.github.com/users/fog/received_events","type":"Organization","site_admin":false},"repo":{"id":40254610,"name":"fog-dynect","full_name":"fog/fog-dynect","owner":{"login":"fog","id":991149,"avatar_url":"https://avatars.githubusercontent.com/u/991149?v=3","gravatar_id":"","url":"https://api.github.com/users/fog","html_url":"https://github.com/fog","followers_url":"https://api.github.com/users/fog/followers","following_url":"https://api.github.com/users/fog/following{/other_user}","gists_url":"https://api.github.com/users/fog/gists{/gist_id}","starred_url":"https://api.github.com/users/fog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fog/subscriptions","organizations_url":"https://api.github.com/users/fog/orgs","repos_url":"https://api.github.com/users/fog/repos","events_url":"https://api.github.com/users/fog/events{/privacy}","received_events_url":"https://api.github.com/users/fog/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fog/fog-dynect","description":"Module for the 'fog' gem to support Dyn Managed DNS http://dyn.com/","fork":false,"url":"https://api.github.com/repos/fog/fog-dynect","forks_url":"https://api.github.com/repos/fog/fog-dynect/forks","keys_url":"https://api.github.com/repos/fog/fog-dynect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fog/fog-dynect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fog/fog-dynect/teams","hooks_url":"https://api.github.com/repos/fog/fog-dynect/hooks","issue_events_url":"https://api.github.com/repos/fog/fog-dynect/issues/events{/number}","events_url":"https://api.github.com/repos/fog/fog-dynect/events","assignees_url":"https://api.github.com/repos/fog/fog-dynect/assignees{/user}","branches_url":"https://api.github.com/repos/fog/fog-dynect/branches{/branch}","tags_url":"https://api.github.com/repos/fog/fog-dynect/tags","blobs_url":"https://api.github.com/repos/fog/fog-dynect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fog/fog-dynect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fog/fog-dynect/git/refs{/sha}","trees_url":"https://api.github.com/repos/fog/fog-dynect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fog/fog-dynect/statuses/{sha}","languages_url":"https://api.github.com/repos/fog/fog-dynect/languages","stargazers_url":"https://api.github.com/repos/fog/fog-dynect/stargazers","contributors_url":"https://api.github.com/repos/fog/fog-dynect/contributors","subscribers_url":"https://api.github.com/repos/fog/fog-dynect/subscribers","subscription_url":"https://api.github.com/repos/fog/fog-dynect/subscription","commits_url":"https://api.github.com/repos/fog/fog-dynect/commits{/sha}","git_commits_url":"https://api.github.com/repos/fog/fog-dynect/git/commits{/sha}","comments_url":"https://api.github.com/repos/fog/fog-dynect/comments{/number}","issue_comment_url":"https://api.github.com/repos/fog/fog-dynect/issues/comments{/number}","contents_url":"https://api.github.com/repos/fog/fog-dynect/contents/{+path}","compare_url":"https://api.github.com/repos/fog/fog-dynect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fog/fog-dynect/merges","archive_url":"https://api.github.com/repos/fog/fog-dynect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fog/fog-dynect/downloads","issues_url":"https://api.github.com/repos/fog/fog-dynect/issues{/number}","pulls_url":"https://api.github.com/repos/fog/fog-dynect/pulls{/number}","milestones_url":"https://api.github.com/repos/fog/fog-dynect/milestones{/number}","notifications_url":"https://api.github.com/repos/fog/fog-dynect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fog/fog-dynect/labels{/name}","releases_url":"https://api.github.com/repos/fog/fog-dynect/releases{/id}","deployments_url":"https://api.github.com/repos/fog/fog-dynect/deployments","created_at":"2015-08-05T15:54:47Z","updated_at":"2015-08-06T20:17:20Z","pushed_at":"2015-09-16T17:12:52Z","git_url":"git://github.com/fog/fog-dynect.git","ssh_url":"git@github.com:fog/fog-dynect.git","clone_url":"https://github.com/fog/fog-dynect.git","svn_url":"https://github.com/fog/fog-dynect","homepage":null,"size":2574,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fog/fog-dynect/pulls/3"},"html":{"href":"https://github.com/fog/fog-dynect/pull/3"},"issue":{"href":"https://api.github.com/repos/fog/fog-dynect/issues/3"},"comments":{"href":"https://api.github.com/repos/fog/fog-dynect/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/fog/fog-dynect/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/fog/fog-dynect/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fog/fog-dynect/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/fog/fog-dynect/statuses/082af4959ae1f6675d0e2d5def36ed768ea5e061"}}}}