This repository has been archived by the owner on Jan 7, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Spree | ||
module API | ||
class Client | ||
module Zones | ||
def zones(options={}) | ||
get('zones', options)['zones'] | ||
end | ||
|
||
def zone(id, options={}) | ||
get("zones/#{id}", options) | ||
end | ||
|
||
def new_zone(options={}) | ||
get("zones/#{id}/new", options) | ||
end | ||
|
||
def create_zone(options={}) | ||
post("zones", options) | ||
end | ||
|
||
def update_zone(id, options={}) | ||
put("zones/#{id}", options) | ||
end | ||
|
||
def delete_zone(id, options={}) | ||
delete("zones/#{id}", options) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe Spree::API::Client::Zones do | ||
describe 'zones' do | ||
it 'should load zones' do | ||
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987') | ||
zones = client.zones | ||
zones.should be_a(Array) | ||
end | ||
end | ||
end |