Skip to content

Commit

Permalink
Guide: API: Update countries documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nnande committed Mar 20, 2017
1 parent 8e8c487 commit fbea3ff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
11 changes: 5 additions & 6 deletions guides/content/api/countries.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ per_page
<%= json(:country) do |h|
{ countries: [h],
count: 25,
pages: 5,
current_page: 1 }
current_page: 1,
pages: 5 }
end %>
## Search
Expand All @@ -50,8 +50,8 @@ The search results are paginated.
<%= json(:country) do |h|
{ countries: [h],
count: 25,
pages: 5,
current_page: 1 }
current_page: 1,
pages: 5 }
end %>
Results can be returned in a specific order by specifying which field to sort by when making a request.
Expand All @@ -69,5 +69,4 @@ GET /api/v1/countries/1```
### Response
<%= headers 200 %>
<%= json(:country) %>
<%= json(:country_with_state) %>
35 changes: 18 additions & 17 deletions guides/lib/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -904,30 +904,31 @@ def commit(sha)
"iso"=>"US",
"iso3"=>"USA",
"name"=>"United States",
"numcode"=>1,
"states"=> [COUNTRY_STATE]
"numcode"=>1
}

STATE ||=
{
"abbr"=>"NY",
"country_id"=>1,
"id"=>1,
"name"=>"New York"
"name"=>"New York",
"abbr"=>"NY",
"country_id"=>1
}

SECONDARY_TAXON ||=
{
"id"=>3,
"name"=>"T-Shirts",
"pretty_name"=>"T-Shirts",
"permalink"=>"brands/t-shirts",
"parent_id"=>1,
"taxonomy_id"=>1,
"meta_title"=>"T-Shirts",
"meta_description"=>"T-Shirts",
"taxons"=>[]
}
COUNTRY_WITH_STATE ||= COUNTRY.merge("states" => [STATE])

SECONDARY_TAXON ||=
{
"id"=>3,
"name"=>"T-Shirts",
"pretty_name"=>"T-Shirts",
"permalink"=>"brands/t-shirts",
"parent_id"=>1,
"taxonomy_id"=>1,
"meta_title"=>"T-Shirts",
"meta_description"=>"T-Shirts",
"taxons"=>[]
}

TAXON_WITH_CHILDREN ||= TAXON.merge("taxons" => [SECONDARY_TAXON])
TAXON_WITHOUT_CHILDREN ||= TAXON.merge("taxons" => [])
Expand Down

0 comments on commit fbea3ff

Please sign in to comment.