diff --git a/lib/jsonapi/resource_serializer.rb b/lib/jsonapi/resource_serializer.rb index e8ad66804..5e49ba467 100644 --- a/lib/jsonapi/resource_serializer.rb +++ b/lib/jsonapi/resource_serializer.rb @@ -217,7 +217,7 @@ def format_route(route) end def self_link(source, association) - "#{self_href(source)}/links/#{format_route(association.name)}" + "#{self_href(source)}/relationships/#{format_route(association.name)}" end def related_link(source, association) diff --git a/lib/jsonapi/routing_ext.rb b/lib/jsonapi/routing_ext.rb index 08ffb3615..5d51abcfb 100644 --- a/lib/jsonapi/routing_ext.rb +++ b/lib/jsonapi/routing_ext.rb @@ -95,17 +95,17 @@ def jsonapi_link(*links) methods = links_methods(options) if methods.include?(:show) - match "links/#{formatted_association_name}", controller: options[:controller], + match "relationships/#{formatted_association_name}", controller: options[:controller], action: 'show_association', association: link_type.to_s, via: [:get] end if methods.include?(:update) - match "links/#{formatted_association_name}", controller: options[:controller], + match "relationships/#{formatted_association_name}", controller: options[:controller], action: 'update_association', association: link_type.to_s, via: [:put, :patch] end if methods.include?(:destroy) - match "links/#{formatted_association_name}", controller: options[:controller], + match "relationships/#{formatted_association_name}", controller: options[:controller], action: 'destroy_association', association: link_type.to_s, via: [:delete] end end @@ -121,22 +121,22 @@ def jsonapi_links(*links) methods = links_methods(options) if methods.include?(:show) - match "links/#{formatted_association_name}", controller: options[:controller], + match "relationships/#{formatted_association_name}", controller: options[:controller], action: 'show_association', association: link_type.to_s, via: [:get] end if methods.include?(:create) - match "links/#{formatted_association_name}", controller: options[:controller], + match "relationships/#{formatted_association_name}", controller: options[:controller], action: 'create_association', association: link_type.to_s, via: [:post] end if methods.include?(:update) - match "links/#{formatted_association_name}", controller: options[:controller], + match "relationships/#{formatted_association_name}", controller: options[:controller], action: 'update_association', association: link_type.to_s, via: [:put, :patch] end if methods.include?(:destroy) - match "links/#{formatted_association_name}/:keys", controller: options[:controller], + match "relationships/#{formatted_association_name}/:keys", controller: options[:controller], action: 'destroy_association', association: link_type.to_s, via: [:delete] end end diff --git a/test/controllers/controller_test.rb b/test/controllers/controller_test.rb index 113a4cb4c..716642675 100644 --- a/test/controllers/controller_test.rb +++ b/test/controllers/controller_test.rb @@ -1394,7 +1394,7 @@ def test_show_has_one_relationship id: '1' }, links: { - self: 'http://test.host/posts/1/links/author', + self: 'http://test.host/posts/1/relationships/author', related: 'http://test.host/posts/1/author' } } @@ -1409,7 +1409,7 @@ def test_show_has_many_relationship {type: 'tags', id: '5'} ], links: { - self: 'http://test.host/posts/2/links/tags', + self: 'http://test.host/posts/2/relationships/tags', related: 'http://test.host/posts/2/tags' } } @@ -1428,7 +1428,7 @@ def test_show_has_one_relationship_nil { data: nil, links: { - self: 'http://test.host/posts/17/links/author', + self: 'http://test.host/posts/17/relationships/author', related: 'http://test.host/posts/17/author' } } @@ -1881,19 +1881,19 @@ def test_get_related_resource relationships: { comments: { links: { - self: 'http://test.host/people/1/links/comments', + self: 'http://test.host/people/1/relationships/comments', related: 'http://test.host/people/1/comments' } }, posts: { links: { - self: 'http://test.host/people/1/links/posts', + self: 'http://test.host/people/1/relationships/posts', related: 'http://test.host/people/1/posts' } }, preferences: { links: { - self: 'http://test.host/people/1/links/preferences', + self: 'http://test.host/people/1/relationships/preferences', related: 'http://test.host/people/1/preferences' }, data: { @@ -1903,7 +1903,7 @@ def test_get_related_resource }, "hair-cut" => { "links" => { - "self" => "http://test.host/people/1/links/hair_cut", + "self" => "http://test.host/people/1/relationships/hair_cut", "related" => "http://test.host/people/1/hair_cut" }, "data" => nil @@ -2057,7 +2057,7 @@ class Api::V1::PostsControllerTest < ActionController::TestCase def test_show_post_namespaced get :show, {id: '1'} assert_response :success - assert_equal 'http://test.host/api/v1/posts/1/links/writer', json_response['data']['relationships']['writer']['links']['self'] + assert_equal 'http://test.host/api/v1/posts/1/relationships/writer', json_response['data']['relationships']['writer']['links']['self'] end def test_show_post_namespaced_include diff --git a/test/integration/requests/request_test.rb b/test/integration/requests/request_test.rb index a3dd380f1..d655d0512 100644 --- a/test/integration/requests/request_test.rb +++ b/test/integration/requests/request_test.rb @@ -70,10 +70,10 @@ def test_get_camelized_route_and_key_filtered def test_get_camelized_route_and_links JSONAPI.configuration.json_key_format = :camelized_key JSONAPI.configuration.route_format = :camelized_route - get '/api/v4/expenseEntries/1/links/isoCurrency' + get '/api/v4/expenseEntries/1/relationships/isoCurrency' assert_equal 200, status assert_hash_equals({'links' => { - 'self' => 'http://www.example.com/api/v4/expenseEntries/1/links/isoCurrency', + 'self' => 'http://www.example.com/api/v4/expenseEntries/1/relationships/isoCurrency', 'related' => 'http://www.example.com/api/v4/expenseEntries/1/isoCurrency' }, 'data' => { @@ -205,21 +205,21 @@ def test_post_single_minimal_invalid def test_update_association_without_content_type ruby = Section.find_by(name: 'ruby') - patch '/posts/3/links/section', { 'data' => {type: 'sections', id: ruby.id.to_s }}.to_json + patch '/posts/3/relationships/section', { 'data' => {type: 'sections', id: ruby.id.to_s }}.to_json assert_equal 415, status end def test_patch_update_association_has_one ruby = Section.find_by(name: 'ruby') - patch '/posts/3/links/section', { 'data' => {type: 'sections', id: ruby.id.to_s }}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + patch '/posts/3/relationships/section', { 'data' => {type: 'sections', id: ruby.id.to_s }}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 204, status end def test_put_update_association_has_one ruby = Section.find_by(name: 'ruby') - put '/posts/3/links/section', { 'data' => {type: 'sections', id: ruby.id.to_s }}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + put '/posts/3/relationships/section', { 'data' => {type: 'sections', id: ruby.id.to_s }}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 204, status end @@ -228,14 +228,14 @@ def test_patch_update_association_has_many_acts_as_set # Comments are acts_as_set=false so PUT/PATCH should respond with 403 rogue = Comment.find_by(body: 'Rogue Comment Here') - patch '/posts/5/links/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + patch '/posts/5/relationships/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 403, status end def test_post_update_association_has_many rogue = Comment.find_by(body: 'Rogue Comment Here') - post '/posts/5/links/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + post '/posts/5/relationships/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 204, status end @@ -244,7 +244,7 @@ def test_put_update_association_has_many_acts_as_set # Comments are acts_as_set=false so PUT/PATCH should respond with 403. Note: JR currently treats PUT and PATCH as equivalent rogue = Comment.find_by(body: 'Rogue Comment Here') - put '/posts/5/links/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE + put '/posts/5/relationships/comments', { 'data' => [{type: 'comments', id: rogue.id.to_s }]}.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE assert_equal 403, status end @@ -416,7 +416,7 @@ def test_flow_link_has_one_self_link assert_equal 200, status assert_hash_equals(json_response, { 'links' => { - 'self' => 'http://www.example.com/posts/1/links/author', + 'self' => 'http://www.example.com/posts/1/relationships/author', 'related' => 'http://www.example.com/posts/1/author' }, 'data' => {type: 'people', id: '1'} @@ -433,7 +433,7 @@ def test_flow_link_has_many_self_link assert_hash_equals(json_response, { 'links' => { - 'self' => 'http://www.example.com/posts/1/links/tags', + 'self' => 'http://www.example.com/posts/1/relationships/tags', 'related' => 'http://www.example.com/posts/1/tags' }, 'data' => [ @@ -460,7 +460,7 @@ def test_flow_link_has_many_self_link_put assert_hash_equals(json_response, { 'links' => { - 'self' => 'http://www.example.com/posts/5/links/tags', + 'self' => 'http://www.example.com/posts/5/relationships/tags', 'related' => 'http://www.example.com/posts/5/tags' }, 'data' => [ @@ -644,7 +644,7 @@ def test_patch_formatted_dasherized_replace_has_many def test_post_has_many_link JSONAPI.configuration.route_format = :dasherized_route JSONAPI.configuration.json_key_format = :dasherized_key - post '/api/v6/purchase-orders/3/links/line-items', + post '/api/v6/purchase-orders/3/relationships/line-items', { 'data' => [ {'type' => 'line-items', 'id' => '3'}, @@ -658,7 +658,7 @@ def test_post_has_many_link def test_patch_has_many_link JSONAPI.configuration.route_format = :dasherized_route JSONAPI.configuration.json_key_format = :dasherized_key - patch '/api/v6/purchase-orders/3/links/order-flags', + patch '/api/v6/purchase-orders/3/relationships/order-flags', { 'data' => [ {'type' => 'order-flags', 'id' => '1'}, @@ -672,7 +672,7 @@ def test_patch_has_many_link def test_patch_has_one JSONAPI.configuration.route_format = :dasherized_route JSONAPI.configuration.json_key_format = :dasherized_key - patch '/api/v6/line-items/5/links/purchase-order', + patch '/api/v6/line-items/5/relationships/purchase-order', { 'data' => {'type' => 'purchase-orders', 'id' => '3'} }.to_json, "CONTENT_TYPE" => JSONAPI::MEDIA_TYPE diff --git a/test/integration/routes/routes_test.rb b/test/integration/routes/routes_test.rb index 032e19dff..6d41c3705 100644 --- a/test/integration/routes/routes_test.rb +++ b/test/integration/routes/routes_test.rb @@ -18,37 +18,37 @@ def test_routing_posts_show end def test_routing_posts_links_author_show - assert_routing({path: '/posts/1/links/author', method: :get}, + assert_routing({path: '/posts/1/relationships/author', method: :get}, {controller: 'posts', action: 'show_association', post_id: '1', association: 'author'}) end def test_routing_posts_links_author_destroy - assert_routing({path: '/posts/1/links/author', method: :delete}, + assert_routing({path: '/posts/1/relationships/author', method: :delete}, {controller: 'posts', action: 'destroy_association', post_id: '1', association: 'author'}) end def test_routing_posts_links_author_update - assert_routing({path: '/posts/1/links/author', method: :patch}, + assert_routing({path: '/posts/1/relationships/author', method: :patch}, {controller: 'posts', action: 'update_association', post_id: '1', association: 'author'}) end def test_routing_posts_links_tags_show - assert_routing({path: '/posts/1/links/tags', method: :get}, + assert_routing({path: '/posts/1/relationships/tags', method: :get}, {controller: 'posts', action: 'show_association', post_id: '1', association: 'tags'}) end def test_routing_posts_links_tags_destroy - assert_routing({path: '/posts/1/links/tags/1,2', method: :delete}, + assert_routing({path: '/posts/1/relationships/tags/1,2', method: :delete}, {controller: 'posts', action: 'destroy_association', post_id: '1', keys: '1,2', association: 'tags'}) end def test_routing_posts_links_tags_create - assert_routing({path: '/posts/1/links/tags', method: :post}, + assert_routing({path: '/posts/1/relationships/tags', method: :post}, {controller: 'posts', action: 'create_association', post_id: '1', association: 'tags'}) end def test_routing_posts_links_tags_update_acts_as_set - assert_routing({path: '/posts/1/links/tags', method: :patch}, + assert_routing({path: '/posts/1/relationships/tags', method: :patch}, {controller: 'posts', action: 'update_association', post_id: '1', association: 'tags'}) end @@ -64,13 +64,13 @@ def test_routing_v1_posts_delete end def test_routing_v1_posts_links_writer_show - assert_routing({path: '/api/v1/posts/1/links/writer', method: :get}, + assert_routing({path: '/api/v1/posts/1/relationships/writer', method: :get}, {controller: 'api/v1/posts', action: 'show_association', post_id: '1', association: 'writer'}) end # V2 def test_routing_v2_posts_links_author_show - assert_routing({path: '/api/v2/posts/1/links/author', method: :get}, + assert_routing({path: '/api/v2/posts/1/relationships/author', method: :get}, {controller: 'api/v2/posts', action: 'show_association', post_id: '1', association: 'author'}) end @@ -100,7 +100,7 @@ def test_routing_v4_expenseEntries_resources assert_routing({path: '/api/v4/expenseEntries/1', method: :get}, {action: 'show', controller: 'api/v4/expense_entries', id: '1'}) - assert_routing({path: '/api/v4/expenseEntries/1/links/isoCurrency', method: :get}, + assert_routing({path: '/api/v4/expenseEntries/1/relationships/isoCurrency', method: :get}, {controller: 'api/v4/expense_entries', action: 'show_association', expense_entry_id: '1', association: 'iso_currency'}) end @@ -119,7 +119,7 @@ def test_routing_v5_expenseEntries_resources assert_routing({path: '/api/v5/expense-entries/1', method: :get}, {action: 'show', controller: 'api/v5/expense_entries', id: '1'}) - assert_routing({path: '/api/v5/expense-entries/1/links/iso-currency', method: :get}, + assert_routing({path: '/api/v5/expense-entries/1/relationships/iso-currency', method: :get}, {controller: 'api/v5/expense_entries', action: 'show_association', expense_entry_id: '1', association: 'iso_currency'}) end @@ -129,7 +129,7 @@ def test_routing_authors_show end def test_routing_author_links_posts_create_not_acts_as_set - assert_routing({path: '/api/v5/authors/1/links/posts', method: :post}, + assert_routing({path: '/api/v5/authors/1/relationships/posts', method: :post}, {controller: 'api/v5/authors', action: 'create_association', author_id: '1', association: 'posts'}) end @@ -146,12 +146,12 @@ def test_routing_primary_key_jsonapi_resources # end # def test_routing_posts_links_author_except_destroy - # assert_routing({ path: '/api/v3/posts/1/links/author', method: :delete }, + # assert_routing({ path: '/api/v3/posts/1/relationships/author', method: :delete }, # { controller: 'api/v3/posts', action: 'destroy_association', post_id: '1', association: 'author' }) # end # # def test_routing_posts_links_tags_only_create_show - # assert_routing({ path: '/api/v3/posts/1/links/tags/1,2', method: :delete }, + # assert_routing({ path: '/api/v3/posts/1/relationships/tags/1,2', method: :delete }, # { controller: 'api/v3/posts', action: 'destroy_association', post_id: '1', keys: '1,2', association: 'tags' }) # end diff --git a/test/unit/serializer/serializer_test.rb b/test/unit/serializer/serializer_test.rb index 17e84955a..cbbdfd6d3 100644 --- a/test/unit/serializer/serializer_test.rb +++ b/test/unit/serializer/serializer_test.rb @@ -40,14 +40,14 @@ def test_serializer relationships: { section: { links: { - self: 'http://example.com/posts/1/links/section', + self: 'http://example.com/posts/1/relationships/section', related: 'http://example.com/posts/1/section' }, data: nil }, author: { links: { - self: 'http://example.com/posts/1/links/author', + self: 'http://example.com/posts/1/relationships/author', related: 'http://example.com/posts/1/author' }, data: { @@ -57,13 +57,13 @@ def test_serializer }, tags: { links: { - self: 'http://example.com/posts/1/links/tags', + self: 'http://example.com/posts/1/relationships/tags', related: 'http://example.com/posts/1/tags' } }, comments: { links: { - self: 'http://example.com/posts/1/links/comments', + self: 'http://example.com/posts/1/relationships/comments', related: 'http://example.com/posts/1/comments' } } @@ -100,14 +100,14 @@ def test_serializer_namespaced_resource relationships: { section: { links:{ - self: 'http://example.com/api/v1/posts/1/links/section', + self: 'http://example.com/api/v1/posts/1/relationships/section', related: 'http://example.com/api/v1/posts/1/section' }, data: nil }, writer: { links:{ - self: 'http://example.com/api/v1/posts/1/links/writer', + self: 'http://example.com/api/v1/posts/1/relationships/writer', related: 'http://example.com/api/v1/posts/1/writer' }, data: { @@ -117,7 +117,7 @@ def test_serializer_namespaced_resource }, comments: { links:{ - self: 'http://example.com/api/v1/posts/1/links/comments', + self: 'http://example.com/api/v1/posts/1/relationships/comments', related: 'http://example.com/api/v1/posts/1/comments' } } @@ -146,7 +146,7 @@ def test_serializer_limited_fieldset relationships: { author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -184,14 +184,14 @@ def test_serializer_include relationships: { section: { links: { - self: '/posts/1/links/section', + self: '/posts/1/relationships/section', related: '/posts/1/section' }, data: nil }, author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -201,13 +201,13 @@ def test_serializer_include }, tags: { links: { - self: '/posts/1/links/tags', + self: '/posts/1/relationships/tags', related: '/posts/1/tags' } }, comments: { links: { - self: '/posts/1/links/comments', + self: '/posts/1/relationships/comments', related: '/posts/1/comments' } } @@ -228,19 +228,19 @@ def test_serializer_include relationships: { comments: { links: { - self: '/people/1/links/comments', + self: '/people/1/relationships/comments', related: '/people/1/comments' } }, posts: { links: { - self: '/people/1/links/posts', + self: '/people/1/relationships/posts', related: '/people/1/posts' } }, preferences: { links: { - self: '/people/1/links/preferences', + self: '/people/1/relationships/preferences', related: '/people/1/preferences' }, data: { @@ -250,7 +250,7 @@ def test_serializer_include }, hairCut: { links: { - self: "/people/1/links/hairCut", + self: "/people/1/relationships/hairCut", related: "/people/1/hairCut" }, data: nil @@ -286,14 +286,14 @@ def test_serializer_key_format relationships: { section: { links: { - self: '/posts/1/links/section', + self: '/posts/1/relationships/section', related: '/posts/1/section' }, data: nil }, author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -303,13 +303,13 @@ def test_serializer_key_format }, tags: { links: { - self: '/posts/1/links/tags', + self: '/posts/1/relationships/tags', related: '/posts/1/tags' } }, comments: { links: { - self: '/posts/1/links/comments', + self: '/posts/1/relationships/comments', related: '/posts/1/comments' } } @@ -330,19 +330,19 @@ def test_serializer_key_format relationships: { comments: { links: { - self: '/people/1/links/comments', + self: '/people/1/relationships/comments', related: '/people/1/comments' } }, posts: { links: { - self: '/people/1/links/posts', + self: '/people/1/relationships/posts', related: '/people/1/posts' } }, preferences: { links: { - self: '/people/1/links/preferences', + self: '/people/1/relationships/preferences', related: '/people/1/preferences' }, data: { @@ -352,7 +352,7 @@ def test_serializer_key_format }, hair_cut: { links: { - self: '/people/1/links/hairCut', + self: '/people/1/relationships/hairCut', related: '/people/1/hairCut' }, data: nil @@ -383,14 +383,14 @@ def test_serializer_include_sub_objects relationships: { section: { links: { - self: '/posts/1/links/section', + self: '/posts/1/relationships/section', related: '/posts/1/section' }, data: nil }, author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -400,13 +400,13 @@ def test_serializer_include_sub_objects }, tags: { links: { - self: '/posts/1/links/tags', + self: '/posts/1/relationships/tags', related: '/posts/1/tags' } }, comments: { links: { - self: '/posts/1/links/comments', + self: '/posts/1/relationships/comments', related: '/posts/1/comments' }, data: [ @@ -429,7 +429,7 @@ def test_serializer_include_sub_objects relationships: { posts: { links: { - self: '/tags/1/links/posts', + self: '/tags/1/relationships/posts', related: '/tags/1/posts' } } @@ -447,7 +447,7 @@ def test_serializer_include_sub_objects relationships: { posts: { links: { - self: '/tags/2/links/posts', + self: '/tags/2/relationships/posts', related: '/tags/2/posts' } } @@ -465,7 +465,7 @@ def test_serializer_include_sub_objects relationships: { posts: { links: { - self: '/tags/4/links/posts', + self: '/tags/4/relationships/posts', related: '/tags/4/posts' }, } @@ -483,7 +483,7 @@ def test_serializer_include_sub_objects relationships: { author: { links: { - self: '/comments/1/links/author', + self: '/comments/1/relationships/author', related: '/comments/1/author' }, data: { @@ -493,7 +493,7 @@ def test_serializer_include_sub_objects }, post: { links: { - self: '/comments/1/links/post', + self: '/comments/1/relationships/post', related: '/comments/1/post' }, data: { @@ -503,7 +503,7 @@ def test_serializer_include_sub_objects }, tags: { links: { - self: '/comments/1/links/tags', + self: '/comments/1/relationships/tags', related: '/comments/1/tags' }, data: [ @@ -525,7 +525,7 @@ def test_serializer_include_sub_objects relationships: { author: { links: { - self: '/comments/2/links/author', + self: '/comments/2/relationships/author', related: '/comments/2/author' }, data: { @@ -535,7 +535,7 @@ def test_serializer_include_sub_objects }, post: { links: { - self: '/comments/2/links/post', + self: '/comments/2/relationships/post', related: '/comments/2/post' }, data: { @@ -545,7 +545,7 @@ def test_serializer_include_sub_objects }, tags: { links: { - self: '/comments/2/links/tags', + self: '/comments/2/relationships/tags', related: '/comments/2/tags' }, data: [ @@ -580,14 +580,14 @@ def test_serializer_include_has_many_sub_objects_only relationships: { section: { links: { - self: '/posts/1/links/section', + self: '/posts/1/relationships/section', related: '/posts/1/section' }, data: nil }, author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -597,13 +597,13 @@ def test_serializer_include_has_many_sub_objects_only }, tags: { links: { - self: '/posts/1/links/tags', + self: '/posts/1/relationships/tags', related: '/posts/1/tags' } }, comments: { links: { - self: '/posts/1/links/comments', + self: '/posts/1/relationships/comments', related: '/posts/1/comments' } } @@ -622,7 +622,7 @@ def test_serializer_include_has_many_sub_objects_only relationships: { posts: { links: { - self: '/tags/1/links/posts', + self: '/tags/1/relationships/posts', related: '/tags/1/posts' } } @@ -640,7 +640,7 @@ def test_serializer_include_has_many_sub_objects_only relationships: { posts: { links: { - self: '/tags/2/links/posts', + self: '/tags/2/relationships/posts', related: '/tags/2/posts' } } @@ -658,7 +658,7 @@ def test_serializer_include_has_many_sub_objects_only relationships: { posts: { links: { - self: '/tags/4/links/posts', + self: '/tags/4/relationships/posts', related: '/tags/4/posts' } } @@ -688,14 +688,14 @@ def test_serializer_include_has_one_sub_objects_only relationships: { section: { links: { - self: '/posts/1/links/section', + self: '/posts/1/relationships/section', related: '/posts/1/section' }, data: nil }, author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -705,13 +705,13 @@ def test_serializer_include_has_one_sub_objects_only }, tags: { links: { - self: '/posts/1/links/tags', + self: '/posts/1/relationships/tags', related: '/posts/1/tags' } }, comments: { links: { - self: '/posts/1/links/comments', + self: '/posts/1/relationships/comments', related: '/posts/1/comments' } } @@ -730,7 +730,7 @@ def test_serializer_include_has_one_sub_objects_only relationships: { author: { links: { - self: '/comments/1/links/author', + self: '/comments/1/relationships/author', related: '/comments/1/author' }, data: { @@ -740,7 +740,7 @@ def test_serializer_include_has_one_sub_objects_only }, post: { links: { - self: '/comments/1/links/post', + self: '/comments/1/relationships/post', related: '/comments/1/post' }, data: { @@ -750,7 +750,7 @@ def test_serializer_include_has_one_sub_objects_only }, tags: { links: { - self: '/comments/1/links/tags', + self: '/comments/1/relationships/tags', related: '/comments/1/tags' } } @@ -785,13 +785,13 @@ def test_serializer_different_foreign_key relationships: { posts: { links: { - self: '/people/2/links/posts', + self: '/people/2/relationships/posts', related: '/people/2/posts' } }, comments: { links: { - self: '/people/2/links/comments', + self: '/people/2/relationships/comments', related: '/people/2/comments' }, data: [ @@ -801,14 +801,14 @@ def test_serializer_different_foreign_key }, preferences: { links: { - self: "/people/2/links/preferences", + self: "/people/2/relationships/preferences", related: "/people/2/preferences" }, data: nil }, hairCut: { links: { - self: "/people/2/links/hairCut", + self: "/people/2/relationships/hairCut", related: "/people/2/hairCut" }, data: nil @@ -828,7 +828,7 @@ def test_serializer_different_foreign_key relationships: { author: { links: { - self: '/comments/2/links/author', + self: '/comments/2/relationships/author', related: '/comments/2/author' }, data: { @@ -838,7 +838,7 @@ def test_serializer_different_foreign_key }, post: { links: { - self: '/comments/2/links/post', + self: '/comments/2/relationships/post', related: '/comments/2/post' }, data: { @@ -848,7 +848,7 @@ def test_serializer_different_foreign_key }, tags: { links: { - self: '/comments/2/links/tags', + self: '/comments/2/relationships/tags', related: '/comments/2/tags' } } @@ -866,7 +866,7 @@ def test_serializer_different_foreign_key relationships: { author: { links: { - self: '/comments/3/links/author', + self: '/comments/3/relationships/author', related: '/comments/3/author' }, data: { @@ -876,7 +876,7 @@ def test_serializer_different_foreign_key }, post: { links: { - self: '/comments/3/links/post', + self: '/comments/3/relationships/post', related: '/comments/3/post' }, data: { @@ -886,7 +886,7 @@ def test_serializer_different_foreign_key }, tags: { links: { - self: '/comments/3/links/tags', + self: '/comments/3/relationships/tags', related: '/comments/3/tags' } } @@ -922,14 +922,14 @@ def test_serializer_array_of_resources relationships: { section: { links: { - self: '/posts/1/links/section', + self: '/posts/1/relationships/section', related: '/posts/1/section' }, data: nil }, author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -939,13 +939,13 @@ def test_serializer_array_of_resources }, tags: { links: { - self: '/posts/1/links/tags', + self: '/posts/1/relationships/tags', related: '/posts/1/tags' } }, comments: { links: { - self: '/posts/1/links/comments', + self: '/posts/1/relationships/comments', related: '/posts/1/comments' }, data: [ @@ -969,7 +969,7 @@ def test_serializer_array_of_resources relationships: { section: { links: { - self: '/posts/2/links/section', + self: '/posts/2/relationships/section', related: '/posts/2/section' }, data: { @@ -979,7 +979,7 @@ def test_serializer_array_of_resources }, author: { links: { - self: '/posts/2/links/author', + self: '/posts/2/relationships/author', related: '/posts/2/author' }, data: { @@ -989,13 +989,13 @@ def test_serializer_array_of_resources }, tags: { links: { - self: '/posts/2/links/tags', + self: '/posts/2/relationships/tags', related: '/posts/2/tags' } }, comments: { links: { - self: '/posts/2/links/comments', + self: '/posts/2/relationships/comments', related: '/posts/2/comments' }, data: [ @@ -1018,7 +1018,7 @@ def test_serializer_array_of_resources relationships: { posts: { links: { - self: '/tags/1/links/posts', + self: '/tags/1/relationships/posts', related: '/tags/1/posts' } } @@ -1036,7 +1036,7 @@ def test_serializer_array_of_resources relationships: { posts: { links: { - self: '/tags/2/links/posts', + self: '/tags/2/relationships/posts', related: '/tags/2/posts' } } @@ -1054,7 +1054,7 @@ def test_serializer_array_of_resources relationships: { posts: { links: { - self: '/tags/4/links/posts', + self: '/tags/4/relationships/posts', related: '/tags/4/posts' } } @@ -1072,7 +1072,7 @@ def test_serializer_array_of_resources relationships: { posts: { links: { - self: '/tags/5/links/posts', + self: '/tags/5/relationships/posts', related: '/tags/5/posts' } } @@ -1090,7 +1090,7 @@ def test_serializer_array_of_resources relationships: { author: { links: { - self: '/comments/1/links/author', + self: '/comments/1/relationships/author', related: '/comments/1/author' }, data: { @@ -1100,7 +1100,7 @@ def test_serializer_array_of_resources }, post: { links: { - self: '/comments/1/links/post', + self: '/comments/1/relationships/post', related: '/comments/1/post' }, data: { @@ -1110,7 +1110,7 @@ def test_serializer_array_of_resources }, tags: { links: { - self: '/comments/1/links/tags', + self: '/comments/1/relationships/tags', related: '/comments/1/tags' }, data: [ @@ -1132,7 +1132,7 @@ def test_serializer_array_of_resources relationships: { author: { links: { - self: '/comments/2/links/author', + self: '/comments/2/relationships/author', related: '/comments/2/author' }, data: { @@ -1142,7 +1142,7 @@ def test_serializer_array_of_resources }, post: { links: { - self: '/comments/2/links/post', + self: '/comments/2/relationships/post', related: '/comments/2/post' }, data: { @@ -1152,7 +1152,7 @@ def test_serializer_array_of_resources }, tags: { links: { - self: '/comments/2/links/tags', + self: '/comments/2/relationships/tags', related: '/comments/2/tags' }, data: [ @@ -1174,7 +1174,7 @@ def test_serializer_array_of_resources relationships: { author: { links: { - self: '/comments/3/links/author', + self: '/comments/3/relationships/author', related: '/comments/3/author' }, data: { @@ -1184,7 +1184,7 @@ def test_serializer_array_of_resources }, post: { links: { - self: '/comments/3/links/post', + self: '/comments/3/relationships/post', related: '/comments/3/post' }, data: { @@ -1194,7 +1194,7 @@ def test_serializer_array_of_resources }, tags: { links: { - self: '/comments/3/links/tags', + self: '/comments/3/relationships/tags', related: '/comments/3/tags' }, data: [ @@ -1232,7 +1232,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { author: { links: { - self: '/posts/1/links/author', + self: '/posts/1/relationships/author', related: '/posts/1/author' }, data: { @@ -1254,7 +1254,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { author: { links: { - self: '/posts/2/links/author', + self: '/posts/2/relationships/author', related: '/posts/2/author' }, data: { @@ -1278,7 +1278,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { author: { links: { - self: '/posts/11/links/author', + self: '/posts/11/relationships/author', related: '/posts/11/author' }, data: { @@ -1300,7 +1300,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { comments: { links: { - self: '/people/1/links/comments', + self: '/people/1/relationships/comments', related: '/people/1/comments' } } @@ -1358,7 +1358,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { post: { links: { - self: '/comments/1/links/post', + self: '/comments/1/relationships/post', related: '/comments/1/post' }, data: { @@ -1380,7 +1380,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { post: { links: { - self: '/comments/2/links/post', + self: '/comments/2/relationships/post', related: '/comments/2/post' }, data: { @@ -1402,7 +1402,7 @@ def test_serializer_array_of_resources_limited_fields relationships: { post: { links: { - self: '/comments/3/links/post', + self: '/comments/3/relationships/post', related: '/comments/3/post' }, data: { @@ -1444,7 +1444,7 @@ def test_serializer_camelized_with_value_formatters relationships: { isoCurrency: { links: { - self: '/expenseEntries/1/links/isoCurrency', + self: '/expenseEntries/1/relationships/isoCurrency', related: '/expenseEntries/1/isoCurrency' }, data: { @@ -1454,7 +1454,7 @@ def test_serializer_camelized_with_value_formatters }, employee: { links: { - self: '/expenseEntries/1/links/employee', + self: '/expenseEntries/1/relationships/employee', related: '/expenseEntries/1/employee' }, data: { @@ -1517,20 +1517,20 @@ def test_serializer_empty_links_null_and_array relationships: { planetType: { links: { - self: '/planets/8/links/planetType', + self: '/planets/8/relationships/planetType', related: '/planets/8/planetType' }, data: nil }, tags: { links: { - self: '/planets/8/links/tags', + self: '/planets/8/relationships/tags', related: '/planets/8/tags' } }, moons: { links: { - self: '/planets/8/links/moons', + self: '/planets/8/relationships/moons', related: '/planets/8/moons' } } @@ -1564,7 +1564,7 @@ def test_serializer_include_with_empty_links_null_and_array relationships: { planetType: { links: { - self: '/planets/7/links/planetType', + self: '/planets/7/relationships/planetType', related: '/planets/7/planetType' }, data: { @@ -1574,13 +1574,13 @@ def test_serializer_include_with_empty_links_null_and_array }, tags: { links: { - self: '/planets/7/links/tags', + self: '/planets/7/relationships/tags', related: '/planets/7/tags' } }, moons: { links: { - self: '/planets/7/links/moons', + self: '/planets/7/relationships/moons', related: '/planets/7/moons' } } @@ -1599,20 +1599,20 @@ def test_serializer_include_with_empty_links_null_and_array relationships: { planetType: { links: { - self: '/planets/8/links/planetType', + self: '/planets/8/relationships/planetType', related: '/planets/8/planetType' }, data: nil }, tags: { links: { - self: '/planets/8/links/tags', + self: '/planets/8/relationships/tags', related: '/planets/8/tags' } }, moons: { links: { - self: '/planets/8/links/moons', + self: '/planets/8/relationships/moons', related: '/planets/8/moons' } } @@ -1653,14 +1653,14 @@ def test_serializer_booleans relationships: { author: { links: { - self: '/preferences/1/links/author', + self: '/preferences/1/relationships/author', related: '/preferences/1/author' }, data: nil }, friends: { links: { - self: '/preferences/1/links/friends', + self: '/preferences/1/relationships/friends', related: '/preferences/1/friends' } }