{"action":"created","comment":{"url":"https://api.github.com/repos/ejholmes/restforce/pulls/comments/66028731","id":66028731,"diff_hunk":"@@ -344,7 +345,7 @@ def upsert!(sobject, field, attrs)\n           fetch(attrs.keys.find { |k, v| k.to_s.downcase == field.to_s.downcase }, nil)\n         attrs_without_field = attrs.\n           reject { |k, v| k.to_s.downcase == field.to_s.downcase }\n-        response = api_patch \"sobjects/#{sobject}/#{field}/#{external_id}\",\n+        response = api_patch \"sobjects/#{sobject}/#{field}/#{URI.encode(external_id)}\",","path":"lib/restforce/concerns/api.rb","position":10,"original_position":10,"commit_id":"c92ba5099e331c094e3dfbb0b587c1c589772c7b","original_commit_id":"c92ba5099e331c094e3dfbb0b587c1c589772c7b","user":{"login":"timrogers","id":116134,"avatar_url":"https://avatars.githubusercontent.com/u/116134?v=3","gravatar_id":"","url":"https://api.github.com/users/timrogers","html_url":"https://github.com/timrogers","followers_url":"https://api.github.com/users/timrogers/followers","following_url":"https://api.github.com/users/timrogers/following{/other_user}","gists_url":"https://api.github.com/users/timrogers/gists{/gist_id}","starred_url":"https://api.github.com/users/timrogers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timrogers/subscriptions","organizations_url":"https://api.github.com/users/timrogers/orgs","repos_url":"https://api.github.com/users/timrogers/repos","events_url":"https://api.github.com/users/timrogers/events{/privacy}","received_events_url":"https://api.github.com/users/timrogers/received_events","type":"User","site_admin":false},"body":"This looks sensible to me. I had a look through how encoding works, and elsewhere Faraday will do the encoding automatically.\r\n\r\n@nagachika Can you add the same to the `#find` and `#select` methods (which also use an external ID)? Then I'll merge this in.","created_at":"2016-06-07T08:27:38Z","updated_at":"2016-06-07T08:27:38Z","html_url":"https://github.com/ejholmes/restforce/pull/232#discussion_r66028731","pull_request_url":"https://api.github.com/repos/ejholmes/restforce/pulls/232","_links":{"self":{"href":"https://api.github.com/repos/ejholmes/restforce/pulls/comments/66028731"},"html":{"href":"https://github.com/ejholmes/restforce/pull/232#discussion_r66028731"},"pull_request":{"href":"https://api.github.com/repos/ejholmes/restforce/pulls/232"}}},"pull_request":{"url":"https://api.github.com/repos/ejholmes/restforce/pulls/232","id":65581721,"html_url":"https://github.com/ejholmes/restforce/pull/232","diff_url":"https://github.com/ejholmes/restforce/pull/232.diff","patch_url":"https://github.com/ejholmes/restforce/pull/232.patch","issue_url":"https://api.github.com/repos/ejholmes/restforce/issues/232","number":232,"state":"open","locked":false,"title":"encode external id for upsert! to get rid of error with multibytes external id","user":{"login":"nagachika","id":21976,"avatar_url":"https://avatars.githubusercontent.com/u/21976?v=3","gravatar_id":"","url":"https://api.github.com/users/nagachika","html_url":"https://github.com/nagachika","followers_url":"https://api.github.com/users/nagachika/followers","following_url":"https://api.github.com/users/nagachika/following{/other_user}","gists_url":"https://api.github.com/users/nagachika/gists{/gist_id}","starred_url":"https://api.github.com/users/nagachika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagachika/subscriptions","organizations_url":"https://api.github.com/users/nagachika/orgs","repos_url":"https://api.github.com/users/nagachika/repos","events_url":"https://api.github.com/users/nagachika/events{/privacy}","received_events_url":"https://api.github.com/users/nagachika/received_events","type":"User","site_admin":false},"body":"When I pass strings contains multibytes characters as external ID to Restforce::Concerns::API#upsert!, it raise `URI::InvalidURIError:URI must be ascii only` exception.\r\nTo get rid the failure, URI encode the external ID when embeded it into request path.\r\n","created_at":"2016-04-07T06:52:01Z","updated_at":"2016-06-07T08:27:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5c8400a93a46a18265eea4066f5c62dca495a38","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ejholmes/restforce/pulls/232/commits","review_comments_url":"https://api.github.com/repos/ejholmes/restforce/pulls/232/comments","review_comment_url":"https://api.github.com/repos/ejholmes/restforce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ejholmes/restforce/issues/232/comments","statuses_url":"https://api.github.com/repos/ejholmes/restforce/statuses/c92ba5099e331c094e3dfbb0b587c1c589772c7b","head":{"label":"nagachika:fix/upsert_encode_external_id","ref":"fix/upsert_encode_external_id","sha":"c92ba5099e331c094e3dfbb0b587c1c589772c7b","user":{"login":"nagachika","id":21976,"avatar_url":"https://avatars.githubusercontent.com/u/21976?v=3","gravatar_id":"","url":"https://api.github.com/users/nagachika","html_url":"https://github.com/nagachika","followers_url":"https://api.github.com/users/nagachika/followers","following_url":"https://api.github.com/users/nagachika/following{/other_user}","gists_url":"https://api.github.com/users/nagachika/gists{/gist_id}","starred_url":"https://api.github.com/users/nagachika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagachika/subscriptions","organizations_url":"https://api.github.com/users/nagachika/orgs","repos_url":"https://api.github.com/users/nagachika/repos","events_url":"https://api.github.com/users/nagachika/events{/privacy}","received_events_url":"https://api.github.com/users/nagachika/received_events","type":"User","site_admin":false},"repo":{"id":55656505,"name":"restforce","full_name":"nagachika/restforce","owner":{"login":"nagachika","id":21976,"avatar_url":"https://avatars.githubusercontent.com/u/21976?v=3","gravatar_id":"","url":"https://api.github.com/users/nagachika","html_url":"https://github.com/nagachika","followers_url":"https://api.github.com/users/nagachika/followers","following_url":"https://api.github.com/users/nagachika/following{/other_user}","gists_url":"https://api.github.com/users/nagachika/gists{/gist_id}","starred_url":"https://api.github.com/users/nagachika/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagachika/subscriptions","organizations_url":"https://api.github.com/users/nagachika/orgs","repos_url":"https://api.github.com/users/nagachika/repos","events_url":"https://api.github.com/users/nagachika/events{/privacy}","received_events_url":"https://api.github.com/users/nagachika/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nagachika/restforce","description":"A ruby client for the Salesforce REST api.","fork":true,"url":"https://api.github.com/repos/nagachika/restforce","forks_url":"https://api.github.com/repos/nagachika/restforce/forks","keys_url":"https://api.github.com/repos/nagachika/restforce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nagachika/restforce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nagachika/restforce/teams","hooks_url":"https://api.github.com/repos/nagachika/restforce/hooks","issue_events_url":"https://api.github.com/repos/nagachika/restforce/issues/events{/number}","events_url":"https://api.github.com/repos/nagachika/restforce/events","assignees_url":"https://api.github.com/repos/nagachika/restforce/assignees{/user}","branches_url":"https://api.github.com/repos/nagachika/restforce/branches{/branch}","tags_url":"https://api.github.com/repos/nagachika/restforce/tags","blobs_url":"https://api.github.com/repos/nagachika/restforce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nagachika/restforce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nagachika/restforce/git/refs{/sha}","trees_url":"https://api.github.com/repos/nagachika/restforce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nagachika/restforce/statuses/{sha}","languages_url":"https://api.github.com/repos/nagachika/restforce/languages","stargazers_url":"https://api.github.com/repos/nagachika/restforce/stargazers","contributors_url":"https://api.github.com/repos/nagachika/restforce/contributors","subscribers_url":"https://api.github.com/repos/nagachika/restforce/subscribers","subscription_url":"https://api.github.com/repos/nagachika/restforce/subscription","commits_url":"https://api.github.com/repos/nagachika/restforce/commits{/sha}","git_commits_url":"https://api.github.com/repos/nagachika/restforce/git/commits{/sha}","comments_url":"https://api.github.com/repos/nagachika/restforce/comments{/number}","issue_comment_url":"https://api.github.com/repos/nagachika/restforce/issues/comments{/number}","contents_url":"https://api.github.com/repos/nagachika/restforce/contents/{+path}","compare_url":"https://api.github.com/repos/nagachika/restforce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nagachika/restforce/merges","archive_url":"https://api.github.com/repos/nagachika/restforce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nagachika/restforce/downloads","issues_url":"https://api.github.com/repos/nagachika/restforce/issues{/number}","pulls_url":"https://api.github.com/repos/nagachika/restforce/pulls{/number}","milestones_url":"https://api.github.com/repos/nagachika/restforce/milestones{/number}","notifications_url":"https://api.github.com/repos/nagachika/restforce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nagachika/restforce/labels{/name}","releases_url":"https://api.github.com/repos/nagachika/restforce/releases{/id}","deployments_url":"https://api.github.com/repos/nagachika/restforce/deployments","created_at":"2016-04-07T02:20:26Z","updated_at":"2016-04-07T02:20:27Z","pushed_at":"2016-04-07T06:45:01Z","git_url":"git://github.com/nagachika/restforce.git","ssh_url":"git@github.com:nagachika/restforce.git","clone_url":"https://github.com/nagachika/restforce.git","svn_url":"https://github.com/nagachika/restforce","homepage":"","size":721,"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":"ejholmes:master","ref":"master","sha":"04ade41037ff952b70e1d6c2855906d3dd43eab1","user":{"login":"ejholmes","id":95166,"avatar_url":"https://avatars.githubusercontent.com/u/95166?v=3","gravatar_id":"","url":"https://api.github.com/users/ejholmes","html_url":"https://github.com/ejholmes","followers_url":"https://api.github.com/users/ejholmes/followers","following_url":"https://api.github.com/users/ejholmes/following{/other_user}","gists_url":"https://api.github.com/users/ejholmes/gists{/gist_id}","starred_url":"https://api.github.com/users/ejholmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejholmes/subscriptions","organizations_url":"https://api.github.com/users/ejholmes/orgs","repos_url":"https://api.github.com/users/ejholmes/repos","events_url":"https://api.github.com/users/ejholmes/events{/privacy}","received_events_url":"https://api.github.com/users/ejholmes/received_events","type":"User","site_admin":false},"repo":{"id":5575055,"name":"restforce","full_name":"ejholmes/restforce","owner":{"login":"ejholmes","id":95166,"avatar_url":"https://avatars.githubusercontent.com/u/95166?v=3","gravatar_id":"","url":"https://api.github.com/users/ejholmes","html_url":"https://github.com/ejholmes","followers_url":"https://api.github.com/users/ejholmes/followers","following_url":"https://api.github.com/users/ejholmes/following{/other_user}","gists_url":"https://api.github.com/users/ejholmes/gists{/gist_id}","starred_url":"https://api.github.com/users/ejholmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejholmes/subscriptions","organizations_url":"https://api.github.com/users/ejholmes/orgs","repos_url":"https://api.github.com/users/ejholmes/repos","events_url":"https://api.github.com/users/ejholmes/events{/privacy}","received_events_url":"https://api.github.com/users/ejholmes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ejholmes/restforce","description":"A ruby client for the Salesforce REST api.","fork":false,"url":"https://api.github.com/repos/ejholmes/restforce","forks_url":"https://api.github.com/repos/ejholmes/restforce/forks","keys_url":"https://api.github.com/repos/ejholmes/restforce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ejholmes/restforce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ejholmes/restforce/teams","hooks_url":"https://api.github.com/repos/ejholmes/restforce/hooks","issue_events_url":"https://api.github.com/repos/ejholmes/restforce/issues/events{/number}","events_url":"https://api.github.com/repos/ejholmes/restforce/events","assignees_url":"https://api.github.com/repos/ejholmes/restforce/assignees{/user}","branches_url":"https://api.github.com/repos/ejholmes/restforce/branches{/branch}","tags_url":"https://api.github.com/repos/ejholmes/restforce/tags","blobs_url":"https://api.github.com/repos/ejholmes/restforce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ejholmes/restforce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ejholmes/restforce/git/refs{/sha}","trees_url":"https://api.github.com/repos/ejholmes/restforce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ejholmes/restforce/statuses/{sha}","languages_url":"https://api.github.com/repos/ejholmes/restforce/languages","stargazers_url":"https://api.github.com/repos/ejholmes/restforce/stargazers","contributors_url":"https://api.github.com/repos/ejholmes/restforce/contributors","subscribers_url":"https://api.github.com/repos/ejholmes/restforce/subscribers","subscription_url":"https://api.github.com/repos/ejholmes/restforce/subscription","commits_url":"https://api.github.com/repos/ejholmes/restforce/commits{/sha}","git_commits_url":"https://api.github.com/repos/ejholmes/restforce/git/commits{/sha}","comments_url":"https://api.github.com/repos/ejholmes/restforce/comments{/number}","issue_comment_url":"https://api.github.com/repos/ejholmes/restforce/issues/comments{/number}","contents_url":"https://api.github.com/repos/ejholmes/restforce/contents/{+path}","compare_url":"https://api.github.com/repos/ejholmes/restforce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ejholmes/restforce/merges","archive_url":"https://api.github.com/repos/ejholmes/restforce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ejholmes/restforce/downloads","issues_url":"https://api.github.com/repos/ejholmes/restforce/issues{/number}","pulls_url":"https://api.github.com/repos/ejholmes/restforce/pulls{/number}","milestones_url":"https://api.github.com/repos/ejholmes/restforce/milestones{/number}","notifications_url":"https://api.github.com/repos/ejholmes/restforce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ejholmes/restforce/labels{/name}","releases_url":"https://api.github.com/repos/ejholmes/restforce/releases{/id}","deployments_url":"https://api.github.com/repos/ejholmes/restforce/deployments","created_at":"2012-08-27T18:19:05Z","updated_at":"2016-06-01T08:25:31Z","pushed_at":"2016-06-06T08:46:04Z","git_url":"git://github.com/ejholmes/restforce.git","ssh_url":"git@github.com:ejholmes/restforce.git","clone_url":"https://github.com/ejholmes/restforce.git","svn_url":"https://github.com/ejholmes/restforce","homepage":"","size":824,"stargazers_count":361,"watchers_count":361,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":173,"mirror_url":null,"open_issues_count":37,"forks":173,"open_issues":37,"watchers":361,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ejholmes/restforce/pulls/232"},"html":{"href":"https://github.com/ejholmes/restforce/pull/232"},"issue":{"href":"https://api.github.com/repos/ejholmes/restforce/issues/232"},"comments":{"href":"https://api.github.com/repos/ejholmes/restforce/issues/232/comments"},"review_comments":{"href":"https://api.github.com/repos/ejholmes/restforce/pulls/232/comments"},"review_comment":{"href":"https://api.github.com/repos/ejholmes/restforce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ejholmes/restforce/pulls/232/commits"},"statuses":{"href":"https://api.github.com/repos/ejholmes/restforce/statuses/c92ba5099e331c094e3dfbb0b587c1c589772c7b"}}}}
{"actor":{"display_login":"timrogers"}}