{"action":"created","comment":{"url":"https://api.github.com/repos/lml/lev/pulls/comments/35884479","id":35884479,"diff_hunk":"@@ -56,18 +81,29 @@ def save(hash = {})\n     end\n \n     def add_error(error, options = { })\n+      @errors ||= []\n+\n       options = { is_fatal: false }.merge(options)\n-      push('errors', { is_fatal: options[:is_fatal],\n-                       code: error.code,\n-                       message: error.message })\n+\n+      @errors << { is_fatal: options[:is_fatal],\n+                   code: error.code,\n+                   message: error.message }\n+\n+      set(errors: @errors)\n+    end\n+\n+    def as_json(options = {})\n+      json = { id: id, status: status, progress: progress }\n+      [options[:with]].flatten.each { |w| json[w] = send(w) }","path":"lib/lev/status.rb","position":94,"original_position":94,"commit_id":"3d1c23b1f87672b7939c08440f8a5ee29f4df694","original_commit_id":"3d1c23b1f87672b7939c08440f8a5ee29f4df694","user":{"login":"jpslav","id":1001691,"avatar_url":"https://avatars.githubusercontent.com/u/1001691?v=3","gravatar_id":"","url":"https://api.github.com/users/jpslav","html_url":"https://github.com/jpslav","followers_url":"https://api.github.com/users/jpslav/followers","following_url":"https://api.github.com/users/jpslav/following{/other_user}","gists_url":"https://api.github.com/users/jpslav/gists{/gist_id}","starred_url":"https://api.github.com/users/jpslav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpslav/subscriptions","organizations_url":"https://api.github.com/users/jpslav/orgs","repos_url":"https://api.github.com/users/jpslav/repos","events_url":"https://api.github.com/users/jpslav/events{/privacy}","received_events_url":"https://api.github.com/users/jpslav/received_events","type":"User","site_admin":false},"body":"also, can you add a test for this `as_json` method?  Also FWIW this method returns a hash, not json.","created_at":"2015-07-30T15:38:34Z","updated_at":"2015-07-30T15:38:34Z","html_url":"https://github.com/lml/lev/pull/36#discussion_r35884479","pull_request_url":"https://api.github.com/repos/lml/lev/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/lml/lev/pulls/comments/35884479"},"html":{"href":"https://github.com/lml/lev/pull/36#discussion_r35884479"},"pull_request":{"href":"https://api.github.com/repos/lml/lev/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/lml/lev/pulls/36","id":41146351,"html_url":"https://github.com/lml/lev/pull/36","diff_url":"https://github.com/lml/lev/pull/36.diff","patch_url":"https://github.com/lml/lev/pull/36.patch","issue_url":"https://api.github.com/repos/lml/lev/issues/36","number":36,"state":"open","locked":false,"title":"Convert Lev::Status to a proper PORO to represent data","user":{"login":"joemsak","id":98936,"avatar_url":"https://avatars.githubusercontent.com/u/98936?v=3","gravatar_id":"","url":"https://api.github.com/users/joemsak","html_url":"https://github.com/joemsak","followers_url":"https://api.github.com/users/joemsak/followers","following_url":"https://api.github.com/users/joemsak/following{/other_user}","gists_url":"https://api.github.com/users/joemsak/gists{/gist_id}","starred_url":"https://api.github.com/users/joemsak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joemsak/subscriptions","organizations_url":"https://api.github.com/users/joemsak/orgs","repos_url":"https://api.github.com/users/joemsak/repos","events_url":"https://api.github.com/users/joemsak/events{/privacy}","received_events_url":"https://api.github.com/users/joemsak/received_events","type":"User","site_admin":false},"body":"* `Lev::Status` is now an object instead of a hash\r\n  * `#id`, `#status`, `#progress`, and custom methods stored with `#save` allowed\r\n```ruby\r\nstatus = Lev::Status.new\r\nstatus.save(foo: :bar, baz: :qux)\r\nstatus.foo #=> :bar\r\nstatus.baz #=> :qux\r\n```\r\n* Adds `Lev::Status.all` which uses `Lev::Status.send(:job_ids)` to new up `Lev::Status`es\r\n* Adds `Lev::Status.new.send(:track_job_id)` which keeps a running list of `Lev::Status#uuid`s to make `Lev::Status.all` work\r\n* Returns a new `unknown` status when `Lev#Status.find` cannot find your status","created_at":"2015-07-29T16:54:02Z","updated_at":"2015-07-30T15:38:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c0f64027f9a89abd989b7b32a548c4c5b9e53fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lml/lev/pulls/36/commits","review_comments_url":"https://api.github.com/repos/lml/lev/pulls/36/comments","review_comment_url":"https://api.github.com/repos/lml/lev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lml/lev/issues/36/comments","statuses_url":"https://api.github.com/repos/lml/lev/statuses/3d1c23b1f87672b7939c08440f8a5ee29f4df694","head":{"label":"lml:store-status-UUIDs","ref":"store-status-UUIDs","sha":"3d1c23b1f87672b7939c08440f8a5ee29f4df694","user":{"login":"lml","id":1001889,"avatar_url":"https://avatars.githubusercontent.com/u/1001889?v=3","gravatar_id":"","url":"https://api.github.com/users/lml","html_url":"https://github.com/lml","followers_url":"https://api.github.com/users/lml/followers","following_url":"https://api.github.com/users/lml/following{/other_user}","gists_url":"https://api.github.com/users/lml/gists{/gist_id}","starred_url":"https://api.github.com/users/lml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lml/subscriptions","organizations_url":"https://api.github.com/users/lml/orgs","repos_url":"https://api.github.com/users/lml/repos","events_url":"https://api.github.com/users/lml/events{/privacy}","received_events_url":"https://api.github.com/users/lml/received_events","type":"Organization","site_admin":false},"repo":{"id":12761701,"name":"lev","full_name":"lml/lev","owner":{"login":"lml","id":1001889,"avatar_url":"https://avatars.githubusercontent.com/u/1001889?v=3","gravatar_id":"","url":"https://api.github.com/users/lml","html_url":"https://github.com/lml","followers_url":"https://api.github.com/users/lml/followers","following_url":"https://api.github.com/users/lml/following{/other_user}","gists_url":"https://api.github.com/users/lml/gists{/gist_id}","starred_url":"https://api.github.com/users/lml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lml/subscriptions","organizations_url":"https://api.github.com/users/lml/orgs","repos_url":"https://api.github.com/users/lml/repos","events_url":"https://api.github.com/users/lml/events{/privacy}","received_events_url":"https://api.github.com/users/lml/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lml/lev","description":"Ride the rails but don't touch them.","fork":false,"url":"https://api.github.com/repos/lml/lev","forks_url":"https://api.github.com/repos/lml/lev/forks","keys_url":"https://api.github.com/repos/lml/lev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lml/lev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lml/lev/teams","hooks_url":"https://api.github.com/repos/lml/lev/hooks","issue_events_url":"https://api.github.com/repos/lml/lev/issues/events{/number}","events_url":"https://api.github.com/repos/lml/lev/events","assignees_url":"https://api.github.com/repos/lml/lev/assignees{/user}","branches_url":"https://api.github.com/repos/lml/lev/branches{/branch}","tags_url":"https://api.github.com/repos/lml/lev/tags","blobs_url":"https://api.github.com/repos/lml/lev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lml/lev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lml/lev/git/refs{/sha}","trees_url":"https://api.github.com/repos/lml/lev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lml/lev/statuses/{sha}","languages_url":"https://api.github.com/repos/lml/lev/languages","stargazers_url":"https://api.github.com/repos/lml/lev/stargazers","contributors_url":"https://api.github.com/repos/lml/lev/contributors","subscribers_url":"https://api.github.com/repos/lml/lev/subscribers","subscription_url":"https://api.github.com/repos/lml/lev/subscription","commits_url":"https://api.github.com/repos/lml/lev/commits{/sha}","git_commits_url":"https://api.github.com/repos/lml/lev/git/commits{/sha}","comments_url":"https://api.github.com/repos/lml/lev/comments{/number}","issue_comment_url":"https://api.github.com/repos/lml/lev/issues/comments{/number}","contents_url":"https://api.github.com/repos/lml/lev/contents/{+path}","compare_url":"https://api.github.com/repos/lml/lev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lml/lev/merges","archive_url":"https://api.github.com/repos/lml/lev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lml/lev/downloads","issues_url":"https://api.github.com/repos/lml/lev/issues{/number}","pulls_url":"https://api.github.com/repos/lml/lev/pulls{/number}","milestones_url":"https://api.github.com/repos/lml/lev/milestones{/number}","notifications_url":"https://api.github.com/repos/lml/lev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lml/lev/labels{/name}","releases_url":"https://api.github.com/repos/lml/lev/releases{/id}","created_at":"2013-09-11T16:45:36Z","updated_at":"2015-04-16T01:36:45Z","pushed_at":"2015-07-30T14:50:01Z","git_url":"git://github.com/lml/lev.git","ssh_url":"git@github.com:lml/lev.git","clone_url":"https://github.com/lml/lev.git","svn_url":"https://github.com/lml/lev","homepage":"","size":843,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":7,"forks":6,"open_issues":7,"watchers":1,"default_branch":"master"}},"base":{"label":"lml:master","ref":"master","sha":"af05269c23d6a26e4d81813b9fc0f3a1e9b067a2","user":{"login":"lml","id":1001889,"avatar_url":"https://avatars.githubusercontent.com/u/1001889?v=3","gravatar_id":"","url":"https://api.github.com/users/lml","html_url":"https://github.com/lml","followers_url":"https://api.github.com/users/lml/followers","following_url":"https://api.github.com/users/lml/following{/other_user}","gists_url":"https://api.github.com/users/lml/gists{/gist_id}","starred_url":"https://api.github.com/users/lml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lml/subscriptions","organizations_url":"https://api.github.com/users/lml/orgs","repos_url":"https://api.github.com/users/lml/repos","events_url":"https://api.github.com/users/lml/events{/privacy}","received_events_url":"https://api.github.com/users/lml/received_events","type":"Organization","site_admin":false},"repo":{"id":12761701,"name":"lev","full_name":"lml/lev","owner":{"login":"lml","id":1001889,"avatar_url":"https://avatars.githubusercontent.com/u/1001889?v=3","gravatar_id":"","url":"https://api.github.com/users/lml","html_url":"https://github.com/lml","followers_url":"https://api.github.com/users/lml/followers","following_url":"https://api.github.com/users/lml/following{/other_user}","gists_url":"https://api.github.com/users/lml/gists{/gist_id}","starred_url":"https://api.github.com/users/lml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lml/subscriptions","organizations_url":"https://api.github.com/users/lml/orgs","repos_url":"https://api.github.com/users/lml/repos","events_url":"https://api.github.com/users/lml/events{/privacy}","received_events_url":"https://api.github.com/users/lml/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lml/lev","description":"Ride the rails but don't touch them.","fork":false,"url":"https://api.github.com/repos/lml/lev","forks_url":"https://api.github.com/repos/lml/lev/forks","keys_url":"https://api.github.com/repos/lml/lev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lml/lev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lml/lev/teams","hooks_url":"https://api.github.com/repos/lml/lev/hooks","issue_events_url":"https://api.github.com/repos/lml/lev/issues/events{/number}","events_url":"https://api.github.com/repos/lml/lev/events","assignees_url":"https://api.github.com/repos/lml/lev/assignees{/user}","branches_url":"https://api.github.com/repos/lml/lev/branches{/branch}","tags_url":"https://api.github.com/repos/lml/lev/tags","blobs_url":"https://api.github.com/repos/lml/lev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lml/lev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lml/lev/git/refs{/sha}","trees_url":"https://api.github.com/repos/lml/lev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lml/lev/statuses/{sha}","languages_url":"https://api.github.com/repos/lml/lev/languages","stargazers_url":"https://api.github.com/repos/lml/lev/stargazers","contributors_url":"https://api.github.com/repos/lml/lev/contributors","subscribers_url":"https://api.github.com/repos/lml/lev/subscribers","subscription_url":"https://api.github.com/repos/lml/lev/subscription","commits_url":"https://api.github.com/repos/lml/lev/commits{/sha}","git_commits_url":"https://api.github.com/repos/lml/lev/git/commits{/sha}","comments_url":"https://api.github.com/repos/lml/lev/comments{/number}","issue_comment_url":"https://api.github.com/repos/lml/lev/issues/comments{/number}","contents_url":"https://api.github.com/repos/lml/lev/contents/{+path}","compare_url":"https://api.github.com/repos/lml/lev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lml/lev/merges","archive_url":"https://api.github.com/repos/lml/lev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lml/lev/downloads","issues_url":"https://api.github.com/repos/lml/lev/issues{/number}","pulls_url":"https://api.github.com/repos/lml/lev/pulls{/number}","milestones_url":"https://api.github.com/repos/lml/lev/milestones{/number}","notifications_url":"https://api.github.com/repos/lml/lev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lml/lev/labels{/name}","releases_url":"https://api.github.com/repos/lml/lev/releases{/id}","created_at":"2013-09-11T16:45:36Z","updated_at":"2015-04-16T01:36:45Z","pushed_at":"2015-07-30T14:50:01Z","git_url":"git://github.com/lml/lev.git","ssh_url":"git@github.com:lml/lev.git","clone_url":"https://github.com/lml/lev.git","svn_url":"https://github.com/lml/lev","homepage":"","size":843,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":7,"forks":6,"open_issues":7,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lml/lev/pulls/36"},"html":{"href":"https://github.com/lml/lev/pull/36"},"issue":{"href":"https://api.github.com/repos/lml/lev/issues/36"},"comments":{"href":"https://api.github.com/repos/lml/lev/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/lml/lev/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/lml/lev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lml/lev/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/lml/lev/statuses/3d1c23b1f87672b7939c08440f8a5ee29f4df694"}}}}