{"action":"created","comment":{"url":"https://api.github.com/repos/emberjs/data/pulls/comments/32321035","id":32321035,"diff_hunk":"@@ -0,0 +1,831 @@\n+var env, store, adapter;\n+var passedUrl, passedVerb, passedHash;\n+\n+var run = Ember.run;\n+\n+var User, Post, Comment, Handle, GithubHandle, TwitterHandle, Company, DevelopmentShop, DesignStudio;\n+\n+module('integration/adapter/json-api-adapter - JSONAPIAdapter', {\n+  setup: function() {\n+    User = DS.Model.extend({\n+      firstName: DS.attr('string'),\n+      lastName: DS.attr('string'),\n+      posts: DS.hasMany('post', { async: true }),\n+      handles: DS.hasMany('handle', { async: true, polymorphic: true }),\n+      company: DS.belongsTo('company', { async: true, polymorphic: true })\n+    });\n+\n+    Post = DS.Model.extend({\n+      title: DS.attr('string'),\n+      author: DS.belongsTo('user', { async: true }),\n+      comments: DS.hasMany('comment', { async: true })\n+    });\n+\n+    Comment = DS.Model.extend({\n+      text: DS.attr('string'),\n+      post: DS.belongsTo('post', { async: true })\n+    });\n+\n+    Handle = DS.Model.extend({\n+      user: DS.belongsTo('post', { async: true })\n+    });\n+\n+    GithubHandle = Handle.extend({\n+      username: DS.attr('string')\n+    });\n+\n+    TwitterHandle = Handle.extend({\n+      nickname: DS.attr('string')\n+    });\n+\n+    Company = DS.Model.extend({\n+      name: DS.attr('string'),\n+      employees: DS.hasMany('user', { async: true })\n+    });\n+\n+    DevelopmentShop = Company.extend({\n+      coffee: DS.attr('boolean')\n+    });\n+\n+    DesignStudio = Company.extend({\n+      hipsters: DS.attr('number')\n+    });\n+\n+    env = setupStore({\n+      adapter: DS.JSONAPIAdapter,\n+\n+      'user': User,\n+      'post': Post,\n+      'comment': Comment,\n+      'handle': Handle,\n+      'github-handle': GithubHandle,\n+      'twitter-handle': TwitterHandle,\n+      'company': Company,\n+      'development-shop': DevelopmentShop,\n+      'design-studio': DesignStudio\n+    });\n+\n+    store = env.store;\n+    adapter = env.adapter;\n+  },\n+\n+  teardown: function() {\n+    run(env.store, 'destroy');\n+  }\n+});\n+\n+function ajaxResponse(responses) {\n+  var counter = 0;\n+  var index;\n+\n+  passedUrl = [];\n+  passedVerb = [];\n+  passedHash = [];\n+\n+  adapter.ajax = function(url, verb, hash) {\n+    index = counter++;\n+\n+    passedUrl[index] = url;\n+    passedVerb[index] = verb;\n+    passedHash[index] = hash;\n+\n+    return run(Ember.RSVP, 'resolve', responses[index]);\n+  };\n+}\n+\n+if (Ember.FEATURES.isEnabled('ds-new-serializer-api')) {\n+\n+  test('find a single record', function() {\n+    expect(3);\n+\n+    ajaxResponse([{\n+      data: {\n+        type: 'post',\n+        id: '1',\n+        attributes: {\n+          title: 'Ember.js rocks'\n+        }\n+      }\n+    }]);\n+\n+    run(function() {\n+      store.find('post', 1).then(function(post) {\n+        equal(passedUrl[0], '/post/1');","path":"packages/ember-data/tests/integration/adapter/json-api-adapter-test.js","position":113,"original_position":113,"commit_id":"5eb9e3620a44bd689c6f686fdb44935aa8d6ef48","original_commit_id":"392958ad3d5a8440dc23bc4cbe955c8b5cde584c","user":{"login":"wwwdata","id":818880,"avatar_url":"https://avatars.githubusercontent.com/u/818880?v=3","gravatar_id":"","url":"https://api.github.com/users/wwwdata","html_url":"https://github.com/wwwdata","followers_url":"https://api.github.com/users/wwwdata/followers","following_url":"https://api.github.com/users/wwwdata/following{/other_user}","gists_url":"https://api.github.com/users/wwwdata/gists{/gist_id}","starred_url":"https://api.github.com/users/wwwdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wwwdata/subscriptions","organizations_url":"https://api.github.com/users/wwwdata/orgs","repos_url":"https://api.github.com/users/wwwdata/repos","events_url":"https://api.github.com/users/wwwdata/events{/privacy}","received_events_url":"https://api.github.com/users/wwwdata/received_events","type":"User","site_admin":false},"body":"hmm, but it is very confusing to name a single model in plural like `posts`. If we do not want to enforce a pluralized url we need some mechanism to configure the url I guess. On the jsonapi.org website, all the URLs are plural. A lot of backends that generate an API with URLs will generate them in that recommended format, so it should be easy for an ember-data user to use this recommended url scheme. ","created_at":"2015-06-12T14:36:53Z","updated_at":"2015-06-12T14:36:53Z","html_url":"https://github.com/emberjs/data/pull/2904#discussion_r32321035","pull_request_url":"https://api.github.com/repos/emberjs/data/pulls/2904","_links":{"self":{"href":"https://api.github.com/repos/emberjs/data/pulls/comments/32321035"},"html":{"href":"https://github.com/emberjs/data/pull/2904#discussion_r32321035"},"pull_request":{"href":"https://api.github.com/repos/emberjs/data/pulls/2904"}}},"pull_request":{"url":"https://api.github.com/repos/emberjs/data/pulls/2904","id":31562319,"html_url":"https://github.com/emberjs/data/pull/2904","diff_url":"https://github.com/emberjs/data/pull/2904.diff","patch_url":"https://github.com/emberjs/data/pull/2904.patch","issue_url":"https://api.github.com/repos/emberjs/data/issues/2904","number":2904,"state":"open","locked":false,"title":"Implement basic JSON-API adapter","user":{"login":"wecc","id":708205,"avatar_url":"https://avatars.githubusercontent.com/u/708205?v=3","gravatar_id":"","url":"https://api.github.com/users/wecc","html_url":"https://github.com/wecc","followers_url":"https://api.github.com/users/wecc/followers","following_url":"https://api.github.com/users/wecc/following{/other_user}","gists_url":"https://api.github.com/users/wecc/gists{/gist_id}","starred_url":"https://api.github.com/users/wecc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wecc/subscriptions","organizations_url":"https://api.github.com/users/wecc/orgs","repos_url":"https://api.github.com/users/wecc/repos","events_url":"https://api.github.com/users/wecc/events{/privacy}","received_events_url":"https://api.github.com/users/wecc/received_events","type":"User","site_admin":false},"body":"A basic working JSON-API adapter.\r\n\r\n- [ ] Currently does nothing with attribute/relationship keys, should we camelize/dasherize?\r\n- [ ] Needs moar tests","created_at":"2015-03-19T20:23:17Z","updated_at":"2015-06-12T14:36:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb345551b16c28d41c5a2b922e02f15d024df905","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/emberjs/data/pulls/2904/commits","review_comments_url":"https://api.github.com/repos/emberjs/data/pulls/2904/comments","review_comment_url":"https://api.github.com/repos/emberjs/data/pulls/comments{/number}","comments_url":"https://api.github.com/repos/emberjs/data/issues/2904/comments","statuses_url":"https://api.github.com/repos/emberjs/data/statuses/5eb9e3620a44bd689c6f686fdb44935aa8d6ef48","head":{"label":"wecc:json-api-adapter","ref":"json-api-adapter","sha":"5eb9e3620a44bd689c6f686fdb44935aa8d6ef48","user":{"login":"wecc","id":708205,"avatar_url":"https://avatars.githubusercontent.com/u/708205?v=3","gravatar_id":"","url":"https://api.github.com/users/wecc","html_url":"https://github.com/wecc","followers_url":"https://api.github.com/users/wecc/followers","following_url":"https://api.github.com/users/wecc/following{/other_user}","gists_url":"https://api.github.com/users/wecc/gists{/gist_id}","starred_url":"https://api.github.com/users/wecc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wecc/subscriptions","organizations_url":"https://api.github.com/users/wecc/orgs","repos_url":"https://api.github.com/users/wecc/repos","events_url":"https://api.github.com/users/wecc/events{/privacy}","received_events_url":"https://api.github.com/users/wecc/received_events","type":"User","site_admin":false},"repo":{"id":23715690,"name":"data","full_name":"wecc/data","owner":{"login":"wecc","id":708205,"avatar_url":"https://avatars.githubusercontent.com/u/708205?v=3","gravatar_id":"","url":"https://api.github.com/users/wecc","html_url":"https://github.com/wecc","followers_url":"https://api.github.com/users/wecc/followers","following_url":"https://api.github.com/users/wecc/following{/other_user}","gists_url":"https://api.github.com/users/wecc/gists{/gist_id}","starred_url":"https://api.github.com/users/wecc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wecc/subscriptions","organizations_url":"https://api.github.com/users/wecc/orgs","repos_url":"https://api.github.com/users/wecc/repos","events_url":"https://api.github.com/users/wecc/events{/privacy}","received_events_url":"https://api.github.com/users/wecc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wecc/data","description":"A data persistence library for Ember.js.","fork":true,"url":"https://api.github.com/repos/wecc/data","forks_url":"https://api.github.com/repos/wecc/data/forks","keys_url":"https://api.github.com/repos/wecc/data/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wecc/data/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wecc/data/teams","hooks_url":"https://api.github.com/repos/wecc/data/hooks","issue_events_url":"https://api.github.com/repos/wecc/data/issues/events{/number}","events_url":"https://api.github.com/repos/wecc/data/events","assignees_url":"https://api.github.com/repos/wecc/data/assignees{/user}","branches_url":"https://api.github.com/repos/wecc/data/branches{/branch}","tags_url":"https://api.github.com/repos/wecc/data/tags","blobs_url":"https://api.github.com/repos/wecc/data/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wecc/data/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wecc/data/git/refs{/sha}","trees_url":"https://api.github.com/repos/wecc/data/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wecc/data/statuses/{sha}","languages_url":"https://api.github.com/repos/wecc/data/languages","stargazers_url":"https://api.github.com/repos/wecc/data/stargazers","contributors_url":"https://api.github.com/repos/wecc/data/contributors","subscribers_url":"https://api.github.com/repos/wecc/data/subscribers","subscription_url":"https://api.github.com/repos/wecc/data/subscription","commits_url":"https://api.github.com/repos/wecc/data/commits{/sha}","git_commits_url":"https://api.github.com/repos/wecc/data/git/commits{/sha}","comments_url":"https://api.github.com/repos/wecc/data/comments{/number}","issue_comment_url":"https://api.github.com/repos/wecc/data/issues/comments{/number}","contents_url":"https://api.github.com/repos/wecc/data/contents/{+path}","compare_url":"https://api.github.com/repos/wecc/data/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wecc/data/merges","archive_url":"https://api.github.com/repos/wecc/data/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wecc/data/downloads","issues_url":"https://api.github.com/repos/wecc/data/issues{/number}","pulls_url":"https://api.github.com/repos/wecc/data/pulls{/number}","milestones_url":"https://api.github.com/repos/wecc/data/milestones{/number}","notifications_url":"https://api.github.com/repos/wecc/data/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wecc/data/labels{/name}","releases_url":"https://api.github.com/repos/wecc/data/releases{/id}","created_at":"2014-09-05T19:30:55Z","updated_at":"2015-05-07T19:12:21Z","pushed_at":"2015-06-12T07:54:44Z","git_url":"git://github.com/wecc/data.git","ssh_url":"git@github.com:wecc/data.git","clone_url":"https://github.com/wecc/data.git","svn_url":"https://github.com/wecc/data","homepage":"","size":9865,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"emberjs:master","ref":"master","sha":"56196f656b3ad3d86f125b7235eb656bddd86629","user":{"login":"emberjs","id":1253363,"avatar_url":"https://avatars.githubusercontent.com/u/1253363?v=3","gravatar_id":"","url":"https://api.github.com/users/emberjs","html_url":"https://github.com/emberjs","followers_url":"https://api.github.com/users/emberjs/followers","following_url":"https://api.github.com/users/emberjs/following{/other_user}","gists_url":"https://api.github.com/users/emberjs/gists{/gist_id}","starred_url":"https://api.github.com/users/emberjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emberjs/subscriptions","organizations_url":"https://api.github.com/users/emberjs/orgs","repos_url":"https://api.github.com/users/emberjs/repos","events_url":"https://api.github.com/users/emberjs/events{/privacy}","received_events_url":"https://api.github.com/users/emberjs/received_events","type":"Organization","site_admin":false},"repo":{"id":3016562,"name":"data","full_name":"emberjs/data","owner":{"login":"emberjs","id":1253363,"avatar_url":"https://avatars.githubusercontent.com/u/1253363?v=3","gravatar_id":"","url":"https://api.github.com/users/emberjs","html_url":"https://github.com/emberjs","followers_url":"https://api.github.com/users/emberjs/followers","following_url":"https://api.github.com/users/emberjs/following{/other_user}","gists_url":"https://api.github.com/users/emberjs/gists{/gist_id}","starred_url":"https://api.github.com/users/emberjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emberjs/subscriptions","organizations_url":"https://api.github.com/users/emberjs/orgs","repos_url":"https://api.github.com/users/emberjs/repos","events_url":"https://api.github.com/users/emberjs/events{/privacy}","received_events_url":"https://api.github.com/users/emberjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/emberjs/data","description":"A data persistence library for Ember.js.","fork":false,"url":"https://api.github.com/repos/emberjs/data","forks_url":"https://api.github.com/repos/emberjs/data/forks","keys_url":"https://api.github.com/repos/emberjs/data/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emberjs/data/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emberjs/data/teams","hooks_url":"https://api.github.com/repos/emberjs/data/hooks","issue_events_url":"https://api.github.com/repos/emberjs/data/issues/events{/number}","events_url":"https://api.github.com/repos/emberjs/data/events","assignees_url":"https://api.github.com/repos/emberjs/data/assignees{/user}","branches_url":"https://api.github.com/repos/emberjs/data/branches{/branch}","tags_url":"https://api.github.com/repos/emberjs/data/tags","blobs_url":"https://api.github.com/repos/emberjs/data/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emberjs/data/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emberjs/data/git/refs{/sha}","trees_url":"https://api.github.com/repos/emberjs/data/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emberjs/data/statuses/{sha}","languages_url":"https://api.github.com/repos/emberjs/data/languages","stargazers_url":"https://api.github.com/repos/emberjs/data/stargazers","contributors_url":"https://api.github.com/repos/emberjs/data/contributors","subscribers_url":"https://api.github.com/repos/emberjs/data/subscribers","subscription_url":"https://api.github.com/repos/emberjs/data/subscription","commits_url":"https://api.github.com/repos/emberjs/data/commits{/sha}","git_commits_url":"https://api.github.com/repos/emberjs/data/git/commits{/sha}","comments_url":"https://api.github.com/repos/emberjs/data/comments{/number}","issue_comment_url":"https://api.github.com/repos/emberjs/data/issues/comments{/number}","contents_url":"https://api.github.com/repos/emberjs/data/contents/{+path}","compare_url":"https://api.github.com/repos/emberjs/data/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emberjs/data/merges","archive_url":"https://api.github.com/repos/emberjs/data/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emberjs/data/downloads","issues_url":"https://api.github.com/repos/emberjs/data/issues{/number}","pulls_url":"https://api.github.com/repos/emberjs/data/pulls{/number}","milestones_url":"https://api.github.com/repos/emberjs/data/milestones{/number}","notifications_url":"https://api.github.com/repos/emberjs/data/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emberjs/data/labels{/name}","releases_url":"https://api.github.com/repos/emberjs/data/releases{/id}","created_at":"2011-12-20T01:50:40Z","updated_at":"2015-06-11T21:56:32Z","pushed_at":"2015-06-12T14:01:47Z","git_url":"git://github.com/emberjs/data.git","ssh_url":"git@github.com:emberjs/data.git","clone_url":"https://github.com/emberjs/data.git","svn_url":"https://github.com/emberjs/data","homepage":"","size":27742,"stargazers_count":2389,"watchers_count":2389,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":924,"mirror_url":null,"open_issues_count":221,"forks":924,"open_issues":221,"watchers":2389,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/emberjs/data/pulls/2904"},"html":{"href":"https://github.com/emberjs/data/pull/2904"},"issue":{"href":"https://api.github.com/repos/emberjs/data/issues/2904"},"comments":{"href":"https://api.github.com/repos/emberjs/data/issues/2904/comments"},"review_comments":{"href":"https://api.github.com/repos/emberjs/data/pulls/2904/comments"},"review_comment":{"href":"https://api.github.com/repos/emberjs/data/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/emberjs/data/pulls/2904/commits"},"statuses":{"href":"https://api.github.com/repos/emberjs/data/statuses/5eb9e3620a44bd689c6f686fdb44935aa8d6ef48"}}}}