{"action":"created","comment":{"url":"https://api.github.com/repos/ndlib/honeycomb/pulls/comments/67240540","id":67240540,"diff_hunk":"@@ -0,0 +1,54 @@\n+require \"rails_helper\"\n+\n+RSpec.describe SaveMetadata, type: :model do\n+  subject { described_class.call(item, params) }\n+  let(:item) { double(Item, item_metadata: item_metadata, save: true) }\n+  let(:params) { { name: \"name\" } }\n+  let(:item_metadata) { double(valid?: true) }\n+\n+  before(:each) do\n+    allow(Metadata::Setter).to receive(:call).and_return(true)\n+  end\n+\n+  it \"sets the metadata with the metadata setter\" do\n+    expect(Metadata::Setter).to receive(:call).with(item, params).and_return(true)\n+    subject\n+  end\n+\n+  it \"does not set the metadata if the params are nil\" do\n+    expect(Metadata::Setter).to_not receive(:call).with(params)\n+    params = nil\n+    subject\n+  end\n+\n+  it \"calls item#save if the item_metadata is valid? \" do\n+    expect(item_metadata).to receive(:valid?).and_return(true)\n+    expect(item).to receive(:save).and_return(true)\n+    subject\n+  end\n+\n+  it \"does not call item#save if the item_metadata is not valid?\" do\n+    expect(item_metadata).to receive(:valid?).and_return(false)\n+    expect(item).to_not receive(:save)\n+    subject\n+  end\n+\n+  it \"returns the item_metadata if the process is successful\" do\n+    expect(subject).to eq(item_metadata)\n+  end\n+\n+  it \"returns false if the the item_metadata is not valid?\" do\n+    expect(item_metadata).to receive(:valid?).and_return(false)","path":"spec/services/save_metadata_spec.rb","position":41,"original_position":41,"commit_id":"6f45d434a3a11ed9de8fa1ceebbab79735203b11","original_commit_id":"6f45d434a3a11ed9de8fa1ceebbab79735203b11","user":{"login":"jgondron","id":11502744,"avatar_url":"https://avatars.githubusercontent.com/u/11502744?v=3","gravatar_id":"","url":"https://api.github.com/users/jgondron","html_url":"https://github.com/jgondron","followers_url":"https://api.github.com/users/jgondron/followers","following_url":"https://api.github.com/users/jgondron/following{/other_user}","gists_url":"https://api.github.com/users/jgondron/gists{/gist_id}","starred_url":"https://api.github.com/users/jgondron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgondron/subscriptions","organizations_url":"https://api.github.com/users/jgondron/orgs","repos_url":"https://api.github.com/users/jgondron/repos","events_url":"https://api.github.com/users/jgondron/events{/privacy}","received_events_url":"https://api.github.com/users/jgondron/received_events","type":"User","site_admin":false},"body":"Should just be an allow.","created_at":"2016-06-15T20:35:55Z","updated_at":"2016-06-15T20:35:55Z","html_url":"https://github.com/ndlib/honeycomb/pull/376#discussion_r67240540","pull_request_url":"https://api.github.com/repos/ndlib/honeycomb/pulls/376","_links":{"self":{"href":"https://api.github.com/repos/ndlib/honeycomb/pulls/comments/67240540"},"html":{"href":"https://github.com/ndlib/honeycomb/pull/376#discussion_r67240540"},"pull_request":{"href":"https://api.github.com/repos/ndlib/honeycomb/pulls/376"}}},"pull_request":{"url":"https://api.github.com/repos/ndlib/honeycomb/pulls/376","id":73958522,"html_url":"https://github.com/ndlib/honeycomb/pull/376","diff_url":"https://github.com/ndlib/honeycomb/pull/376.diff","patch_url":"https://github.com/ndlib/honeycomb/pull/376.patch","issue_url":"https://api.github.com/repos/ndlib/honeycomb/issues/376","number":376,"state":"open","locked":false,"title":"Dec 1064 update item metadata saving","user":{"login":"jonhartzler","id":124502,"avatar_url":"https://avatars.githubusercontent.com/u/124502?v=3","gravatar_id":"","url":"https://api.github.com/users/jonhartzler","html_url":"https://github.com/jonhartzler","followers_url":"https://api.github.com/users/jonhartzler/followers","following_url":"https://api.github.com/users/jonhartzler/following{/other_user}","gists_url":"https://api.github.com/users/jonhartzler/gists{/gist_id}","starred_url":"https://api.github.com/users/jonhartzler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonhartzler/subscriptions","organizations_url":"https://api.github.com/users/jonhartzler/orgs","repos_url":"https://api.github.com/users/jonhartzler/repos","events_url":"https://api.github.com/users/jonhartzler/events{/privacy}","received_events_url":"https://api.github.com/users/jonhartzler/received_events","type":"User","site_admin":false},"body":"Why: the current implementation was validating the metadata on create which was causing new item creation to fail also there was a bug with the custom metadata validator in that it always used the first loaded collection configuration to validate agains.\r\nWhat:  I separated the routes for updating items and metadata.  All routes to items should only save item data.  There is a new api route v1/items/ID/metadata that saves the metadata.   There is also a new save_metadata class for saving metadata.  \r\nSaveItem no longer saves metadata.  \r\n\r\n","created_at":"2016-06-15T18:15:24Z","updated_at":"2016-06-15T20:35:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0177a4cc62b554e8f9ae0b80dc080317fbfaaf09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ndlib/honeycomb/pulls/376/commits","review_comments_url":"https://api.github.com/repos/ndlib/honeycomb/pulls/376/comments","review_comment_url":"https://api.github.com/repos/ndlib/honeycomb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ndlib/honeycomb/issues/376/comments","statuses_url":"https://api.github.com/repos/ndlib/honeycomb/statuses/6f45d434a3a11ed9de8fa1ceebbab79735203b11","head":{"label":"ndlib:DEC-1064","ref":"DEC-1064","sha":"6f45d434a3a11ed9de8fa1ceebbab79735203b11","user":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"repo":{"id":25221636,"name":"honeycomb","full_name":"ndlib/honeycomb","owner":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ndlib/honeycomb","description":"Honeycomb provides basic collection and item administration, as well as serialization of your collections so they can be used by external applications.","fork":false,"url":"https://api.github.com/repos/ndlib/honeycomb","forks_url":"https://api.github.com/repos/ndlib/honeycomb/forks","keys_url":"https://api.github.com/repos/ndlib/honeycomb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndlib/honeycomb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndlib/honeycomb/teams","hooks_url":"https://api.github.com/repos/ndlib/honeycomb/hooks","issue_events_url":"https://api.github.com/repos/ndlib/honeycomb/issues/events{/number}","events_url":"https://api.github.com/repos/ndlib/honeycomb/events","assignees_url":"https://api.github.com/repos/ndlib/honeycomb/assignees{/user}","branches_url":"https://api.github.com/repos/ndlib/honeycomb/branches{/branch}","tags_url":"https://api.github.com/repos/ndlib/honeycomb/tags","blobs_url":"https://api.github.com/repos/ndlib/honeycomb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndlib/honeycomb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndlib/honeycomb/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndlib/honeycomb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndlib/honeycomb/statuses/{sha}","languages_url":"https://api.github.com/repos/ndlib/honeycomb/languages","stargazers_url":"https://api.github.com/repos/ndlib/honeycomb/stargazers","contributors_url":"https://api.github.com/repos/ndlib/honeycomb/contributors","subscribers_url":"https://api.github.com/repos/ndlib/honeycomb/subscribers","subscription_url":"https://api.github.com/repos/ndlib/honeycomb/subscription","commits_url":"https://api.github.com/repos/ndlib/honeycomb/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndlib/honeycomb/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndlib/honeycomb/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndlib/honeycomb/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndlib/honeycomb/contents/{+path}","compare_url":"https://api.github.com/repos/ndlib/honeycomb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndlib/honeycomb/merges","archive_url":"https://api.github.com/repos/ndlib/honeycomb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndlib/honeycomb/downloads","issues_url":"https://api.github.com/repos/ndlib/honeycomb/issues{/number}","pulls_url":"https://api.github.com/repos/ndlib/honeycomb/pulls{/number}","milestones_url":"https://api.github.com/repos/ndlib/honeycomb/milestones{/number}","notifications_url":"https://api.github.com/repos/ndlib/honeycomb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndlib/honeycomb/labels{/name}","releases_url":"https://api.github.com/repos/ndlib/honeycomb/releases{/id}","deployments_url":"https://api.github.com/repos/ndlib/honeycomb/deployments","created_at":"2014-10-14T18:55:34Z","updated_at":"2016-01-19T14:49:12Z","pushed_at":"2016-06-15T18:20:36Z","git_url":"git://github.com/ndlib/honeycomb.git","ssh_url":"git@github.com:ndlib/honeycomb.git","clone_url":"https://github.com/ndlib/honeycomb.git","svn_url":"https://github.com/ndlib/honeycomb","homepage":"","size":19019,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"ndlib:master","ref":"master","sha":"4b49dfc70075959e972e9edea93b24aa0c425ab6","user":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"repo":{"id":25221636,"name":"honeycomb","full_name":"ndlib/honeycomb","owner":{"login":"ndlib","id":160943,"avatar_url":"https://avatars.githubusercontent.com/u/160943?v=3","gravatar_id":"","url":"https://api.github.com/users/ndlib","html_url":"https://github.com/ndlib","followers_url":"https://api.github.com/users/ndlib/followers","following_url":"https://api.github.com/users/ndlib/following{/other_user}","gists_url":"https://api.github.com/users/ndlib/gists{/gist_id}","starred_url":"https://api.github.com/users/ndlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ndlib/subscriptions","organizations_url":"https://api.github.com/users/ndlib/orgs","repos_url":"https://api.github.com/users/ndlib/repos","events_url":"https://api.github.com/users/ndlib/events{/privacy}","received_events_url":"https://api.github.com/users/ndlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ndlib/honeycomb","description":"Honeycomb provides basic collection and item administration, as well as serialization of your collections so they can be used by external applications.","fork":false,"url":"https://api.github.com/repos/ndlib/honeycomb","forks_url":"https://api.github.com/repos/ndlib/honeycomb/forks","keys_url":"https://api.github.com/repos/ndlib/honeycomb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ndlib/honeycomb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ndlib/honeycomb/teams","hooks_url":"https://api.github.com/repos/ndlib/honeycomb/hooks","issue_events_url":"https://api.github.com/repos/ndlib/honeycomb/issues/events{/number}","events_url":"https://api.github.com/repos/ndlib/honeycomb/events","assignees_url":"https://api.github.com/repos/ndlib/honeycomb/assignees{/user}","branches_url":"https://api.github.com/repos/ndlib/honeycomb/branches{/branch}","tags_url":"https://api.github.com/repos/ndlib/honeycomb/tags","blobs_url":"https://api.github.com/repos/ndlib/honeycomb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ndlib/honeycomb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ndlib/honeycomb/git/refs{/sha}","trees_url":"https://api.github.com/repos/ndlib/honeycomb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ndlib/honeycomb/statuses/{sha}","languages_url":"https://api.github.com/repos/ndlib/honeycomb/languages","stargazers_url":"https://api.github.com/repos/ndlib/honeycomb/stargazers","contributors_url":"https://api.github.com/repos/ndlib/honeycomb/contributors","subscribers_url":"https://api.github.com/repos/ndlib/honeycomb/subscribers","subscription_url":"https://api.github.com/repos/ndlib/honeycomb/subscription","commits_url":"https://api.github.com/repos/ndlib/honeycomb/commits{/sha}","git_commits_url":"https://api.github.com/repos/ndlib/honeycomb/git/commits{/sha}","comments_url":"https://api.github.com/repos/ndlib/honeycomb/comments{/number}","issue_comment_url":"https://api.github.com/repos/ndlib/honeycomb/issues/comments{/number}","contents_url":"https://api.github.com/repos/ndlib/honeycomb/contents/{+path}","compare_url":"https://api.github.com/repos/ndlib/honeycomb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ndlib/honeycomb/merges","archive_url":"https://api.github.com/repos/ndlib/honeycomb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ndlib/honeycomb/downloads","issues_url":"https://api.github.com/repos/ndlib/honeycomb/issues{/number}","pulls_url":"https://api.github.com/repos/ndlib/honeycomb/pulls{/number}","milestones_url":"https://api.github.com/repos/ndlib/honeycomb/milestones{/number}","notifications_url":"https://api.github.com/repos/ndlib/honeycomb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ndlib/honeycomb/labels{/name}","releases_url":"https://api.github.com/repos/ndlib/honeycomb/releases{/id}","deployments_url":"https://api.github.com/repos/ndlib/honeycomb/deployments","created_at":"2014-10-14T18:55:34Z","updated_at":"2016-01-19T14:49:12Z","pushed_at":"2016-06-15T18:20:36Z","git_url":"git://github.com/ndlib/honeycomb.git","ssh_url":"git@github.com:ndlib/honeycomb.git","clone_url":"https://github.com/ndlib/honeycomb.git","svn_url":"https://github.com/ndlib/honeycomb","homepage":"","size":19019,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ndlib/honeycomb/pulls/376"},"html":{"href":"https://github.com/ndlib/honeycomb/pull/376"},"issue":{"href":"https://api.github.com/repos/ndlib/honeycomb/issues/376"},"comments":{"href":"https://api.github.com/repos/ndlib/honeycomb/issues/376/comments"},"review_comments":{"href":"https://api.github.com/repos/ndlib/honeycomb/pulls/376/comments"},"review_comment":{"href":"https://api.github.com/repos/ndlib/honeycomb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ndlib/honeycomb/pulls/376/commits"},"statuses":{"href":"https://api.github.com/repos/ndlib/honeycomb/statuses/6f45d434a3a11ed9de8fa1ceebbab79735203b11"}}}}
{"actor":{"display_login":"jgondron"}}