From 3064724039fca9640b728851d2d2b0f89ef37bb4 Mon Sep 17 00:00:00 2001 From: Nathaniel Nande Date: Mon, 20 Mar 2017 16:51:54 +0100 Subject: [PATCH] Guide: API: Update zones documentation --- guides/content/api/zones.md | 13 +++++++------ guides/lib/resources.rb | 18 +++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/guides/content/api/zones.md b/guides/content/api/zones.md index 4c6f8926a79..1b252eb3d1e 100644 --- a/guides/content/api/zones.md +++ b/guides/content/api/zones.md @@ -29,8 +29,8 @@ per_page <%= json(:zone) do |h| { zones: [h], count: 25, - pages: 5, - current_page: 1 } + current_page: 1, + pages: 5 } end %> ## Search @@ -50,8 +50,8 @@ The search results are paginated. <%= json(:zone) do |h| { zones: [h], count: 25, - pages: 5, - current_page: 1 } + current_page: 1, + pages: 5 } end %> ### Sorting results @@ -99,7 +99,9 @@ a zone member which is a `Spree::Country` record with the `id` attribute of 1, s ### Response <%= headers 201 %> -<%= json(:zone) %> +<%= json(:zone) do |h| + h.merge("name" => "North Pole") +end %> ## Update @@ -113,7 +115,6 @@ PUT /api/v1/zones/1``` To update zone and zone member information, use parameters like this: <%= json \ - id: 1, zone: { name: "North Pole", zone_members: [ diff --git a/guides/lib/resources.rb b/guides/lib/resources.rb index 81847f288f0..4f000f7aa6d 100644 --- a/guides/lib/resources.rb +++ b/guides/lib/resources.rb @@ -485,11 +485,19 @@ def commit(sha) "name" => "Defaukt category" } + ZONE_MEMBER ||= + { + "id"=>1, + "zoneable_type"=>"Spree::Country", + "zoneable_id"=>1 + } + ZONE ||= { "id"=>1, "name"=>"America", - "description"=>"The US" + "description"=>"The US", + "zone_members"=>[ZONE_MEMBER] } SHIPPING_METHOD ||= @@ -947,14 +955,6 @@ def commit(sha) "root" => TAXON_WITHOUT_CHILDREN } - ZONE_MEMBER ||= - { - "id"=>1, - "name"=>"United States", - "zoneable_type"=>"Spree::Country", - "zoneable_id"=>1, - } - RETURN_AUTHORIZATION ||= { "id"=>1,