{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/comments/89681112","pull_request_review_id":10223228,"id":89681112,"diff_hunk":"@@ -391,7 +391,14 @@ def serialize_sequence_type(mapper, object, object_name)\n       # @param model_name [String] Name of the model to retrieve.\n       #\n       def get_model(model_name)\n-        Object.const_get(@context.class.to_s.split('::')[0...-1].join('::') + \"::Models::#{model_name}\")\n+        consts = @context.class.to_s.split('::')\n+        if consts.any?{ |const| const == 'Models' }","path":"runtime/ms_rest/lib/ms_rest/serialization.rb","position":24,"original_position":24,"commit_id":"1d815363749582410fe0155468de753b2ac5b99d","original_commit_id":"1d815363749582410fe0155468de753b2ac5b99d","user":{"login":"devigned","id":386473,"avatar_url":"https://avatars.githubusercontent.com/u/386473?v=3","gravatar_id":"","url":"https://api.github.com/users/devigned","html_url":"https://github.com/devigned","followers_url":"https://api.github.com/users/devigned/followers","following_url":"https://api.github.com/users/devigned/following{/other_user}","gists_url":"https://api.github.com/users/devigned/gists{/gist_id}","starred_url":"https://api.github.com/users/devigned/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devigned/subscriptions","organizations_url":"https://api.github.com/users/devigned/orgs","repos_url":"https://api.github.com/users/devigned/repos","events_url":"https://api.github.com/users/devigned/events{/privacy}","received_events_url":"https://api.github.com/users/devigned/received_events","type":"User","site_admin":false},"body":"Not so much a bug, but another way of including the serialization logic. Honestly, the serialization logic shouldn't need an anchor to the service class. \r\n\r\nJSONable will be decorated onto the model, rather than the @client, and as such, needs to understand the context so it can create a new version of the deserialized object.\r\n\r\nPerhaps, this logic should be decorated onto the model and not known by the service class. I was thinking about doing this larger refactor, but didn't feel like it was my place to make sweeping changes like that.\r\n\r\nDoes this make sense?","created_at":"2016-11-27T01:04:41Z","updated_at":"2016-11-27T01:04:41Z","html_url":"https://github.com/Azure/azure-sdk-for-ruby/pull/599#discussion_r89681112","pull_request_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599","_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/comments/89681112"},"html":{"href":"https://github.com/Azure/azure-sdk-for-ruby/pull/599#discussion_r89681112"},"pull_request":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599","id":94883428,"html_url":"https://github.com/Azure/azure-sdk-for-ruby/pull/599","diff_url":"https://github.com/Azure/azure-sdk-for-ruby/pull/599.diff","patch_url":"https://github.com/Azure/azure-sdk-for-ruby/pull/599.patch","issue_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues/599","number":599,"state":"open","locked":false,"title":"add model to_json, from_json and to_s mixin","user":{"login":"devigned","id":386473,"avatar_url":"https://avatars.githubusercontent.com/u/386473?v=3","gravatar_id":"","url":"https://api.github.com/users/devigned","html_url":"https://github.com/devigned","followers_url":"https://api.github.com/users/devigned/followers","following_url":"https://api.github.com/users/devigned/following{/other_user}","gists_url":"https://api.github.com/users/devigned/gists{/gist_id}","starred_url":"https://api.github.com/users/devigned/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devigned/subscriptions","organizations_url":"https://api.github.com/users/devigned/orgs","repos_url":"https://api.github.com/users/devigned/repos","events_url":"https://api.github.com/users/devigned/events{/privacy}","received_events_url":"https://api.github.com/users/devigned/received_events","type":"User","site_admin":false},"body":"I found it painful to debug output from the lib since the models don't provide much information when called via to_s. This pull request adds to and from json as well as a more robust to_s implementation which includes the json representation of the model.","created_at":"2016-11-22T19:38:42Z","updated_at":"2016-11-27T01:04:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b3aa2f8129348a90f2743ff305c51adbc1dbd482","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599/commits","review_comments_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599/comments","review_comment_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues/599/comments","statuses_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/statuses/1d815363749582410fe0155468de753b2ac5b99d","head":{"label":"devigned:feature/model-serial","ref":"feature/model-serial","sha":"1d815363749582410fe0155468de753b2ac5b99d","user":{"login":"devigned","id":386473,"avatar_url":"https://avatars.githubusercontent.com/u/386473?v=3","gravatar_id":"","url":"https://api.github.com/users/devigned","html_url":"https://github.com/devigned","followers_url":"https://api.github.com/users/devigned/followers","following_url":"https://api.github.com/users/devigned/following{/other_user}","gists_url":"https://api.github.com/users/devigned/gists{/gist_id}","starred_url":"https://api.github.com/users/devigned/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devigned/subscriptions","organizations_url":"https://api.github.com/users/devigned/orgs","repos_url":"https://api.github.com/users/devigned/repos","events_url":"https://api.github.com/users/devigned/events{/privacy}","received_events_url":"https://api.github.com/users/devigned/received_events","type":"User","site_admin":false},"repo":{"id":26329660,"name":"azure-sdk-for-ruby","full_name":"devigned/azure-sdk-for-ruby","owner":{"login":"devigned","id":386473,"avatar_url":"https://avatars.githubusercontent.com/u/386473?v=3","gravatar_id":"","url":"https://api.github.com/users/devigned","html_url":"https://github.com/devigned","followers_url":"https://api.github.com/users/devigned/followers","following_url":"https://api.github.com/users/devigned/following{/other_user}","gists_url":"https://api.github.com/users/devigned/gists{/gist_id}","starred_url":"https://api.github.com/users/devigned/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devigned/subscriptions","organizations_url":"https://api.github.com/users/devigned/orgs","repos_url":"https://api.github.com/users/devigned/repos","events_url":"https://api.github.com/users/devigned/events{/privacy}","received_events_url":"https://api.github.com/users/devigned/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/devigned/azure-sdk-for-ruby","description":"Microsoft Azure SDK for Ruby","fork":true,"url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby","forks_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/forks","keys_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/teams","hooks_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/hooks","issue_events_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/events","assignees_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/tags","blobs_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/languages","stargazers_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/stargazers","contributors_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/contributors","subscribers_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/subscribers","subscription_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/subscription","commits_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/merges","archive_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/downloads","issues_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/labels{/name}","releases_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/devigned/azure-sdk-for-ruby/deployments","created_at":"2014-11-07T17:16:49Z","updated_at":"2016-03-07T15:58:45Z","pushed_at":"2016-11-22T19:49:12Z","git_url":"git://github.com/devigned/azure-sdk-for-ruby.git","ssh_url":"git@github.com:devigned/azure-sdk-for-ruby.git","clone_url":"https://github.com/devigned/azure-sdk-for-ruby.git","svn_url":"https://github.com/devigned/azure-sdk-for-ruby","homepage":"","size":10176,"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":"Azure:master","ref":"master","sha":"04d34f2837278e7d083f5953af0e3a258520ebe6","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":4127095,"name":"azure-sdk-for-ruby","full_name":"Azure/azure-sdk-for-ruby","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-sdk-for-ruby","description":"Ruby SDK for Azure Resource Manager: build and manage your Azure cloud infrastructure (Compute, Virtual Networks, Storage, etc...) using Ruby.","fork":false,"url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby","forks_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/forks","keys_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/teams","hooks_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/events","assignees_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/tags","blobs_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/subscription","commits_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/merges","archive_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/downloads","issues_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/deployments","created_at":"2012-04-24T16:46:39Z","updated_at":"2016-11-21T15:41:50Z","pushed_at":"2016-11-25T07:07:30Z","git_url":"git://github.com/Azure/azure-sdk-for-ruby.git","ssh_url":"git@github.com:Azure/azure-sdk-for-ruby.git","clone_url":"https://github.com/Azure/azure-sdk-for-ruby.git","svn_url":"https://github.com/Azure/azure-sdk-for-ruby","homepage":"","size":11170,"stargazers_count":146,"watchers_count":146,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":162,"mirror_url":null,"open_issues_count":36,"forks":162,"open_issues":36,"watchers":146,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599"},"html":{"href":"https://github.com/Azure/azure-sdk-for-ruby/pull/599"},"issue":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues/599"},"comments":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/issues/599/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/pulls/599/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/azure-sdk-for-ruby/statuses/1d815363749582410fe0155468de753b2ac5b99d"}}}}
{"actor":{"display_login":"devigned"}}