spree-api-client 0.0.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +674 -0
- data/README.md +31 -38
- data/lib/spree_client.rb +3 -0
- data/lib/spree_client.rb~ +71 -0
- data/lib/spree_client/api.rb +1 -0
- data/lib/spree_client/api/v1.rb +53 -0
- data/lib/spree_client/api/v1/products.rb +23 -0
- data/lib/spree_client/api/v1/properties.rb +12 -0
- data/lib/spree_client/api/v1/resources.rb +142 -0
- data/lib/spree_client/api/v1/stock_items.rb +27 -0
- data/lib/spree_client/api/v1/stock_locations.rb +33 -0
- data/lib/spree_client/api/v1/stock_movements.rb +16 -0
- data/lib/spree_client/api/v1/taxonomies.rb +12 -0
- data/lib/spree_client/api/v1/variants.rb +13 -0
- data/lib/spree_client/attributes.rb +27 -0
- data/lib/spree_client/models.rb +5 -0
- data/lib/spree_client/models/product.rb +7 -0
- data/lib/spree_client/models/property.rb +6 -0
- data/lib/spree_client/models/stock_item.rb +7 -0
- data/lib/spree_client/models/stock_location.rb +7 -0
- data/lib/spree_client/models/stock_movement.rb +7 -0
- data/lib/spree_client/models/store.rb +7 -0
- data/lib/spree_client/models/taxonomy.rb +5 -0
- data/lib/spree_client/models/variant.rb +7 -0
- metadata +79 -118
- data/.gitignore +0 -17
- data/.travis.yml +0 -9
- data/CONTRIBUTING.md +0 -8
- data/Gemfile +0 -3
- data/LICENSE +0 -22
- data/Rakefile +0 -7
- data/lib/spree-api-client.rb +0 -49
- data/lib/spree-api-client/addresses.rb +0 -15
- data/lib/spree-api-client/connection.rb +0 -30
- data/lib/spree-api-client/countries.rb +0 -15
- data/lib/spree-api-client/line_items.rb +0 -19
- data/lib/spree-api-client/orders.rb +0 -31
- data/lib/spree-api-client/payments.rb +0 -43
- data/lib/spree-api-client/products.rb +0 -31
- data/lib/spree-api-client/properties.rb +0 -31
- data/lib/spree-api-client/request.rb +0 -49
- data/lib/spree-api-client/return_authorizations.rb +0 -31
- data/lib/spree-api-client/shipments.rb +0 -15
- data/lib/spree-api-client/taxonomies.rb +0 -31
- data/lib/spree-api-client/taxons.rb +0 -27
- data/lib/spree-api-client/variants.rb +0 -31
- data/lib/spree-api-client/version.rb +0 -7
- data/lib/spree-api-client/zones.rb +0 -31
- data/spec/addresses_spec.rb +0 -11
- data/spec/client_spec.rb +0 -31
- data/spec/countries_spec.rb +0 -11
- data/spec/orders_spec.rb +0 -11
- data/spec/payments_spec.rb +0 -11
- data/spec/products_spec.rb +0 -11
- data/spec/properties_spec.rb +0 -11
- data/spec/return_authorizations_spec.rb +0 -11
- data/spec/shipments_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -5
- data/spec/taxonomies_spec.rb +0 -11
- data/spec/taxons_spec.rb +0 -11
- data/spec/variants_spec.rb +0 -11
- data/spec/zones_spec.rb +0 -11
- data/spree-api-client.gemspec +0 -27
@@ -1,31 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module API
|
3
|
-
class Client
|
4
|
-
module Variants
|
5
|
-
def variants(product_id, options={})
|
6
|
-
get("products/#{product_id}/variants", options)['variants']
|
7
|
-
end
|
8
|
-
|
9
|
-
def variant(product_id, variant_id, options={})
|
10
|
-
get("products/#{product_id}/variants/#{variant_id}", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def new_variant(product_id, options={})
|
14
|
-
get("products/#{product_id}/variants/new", options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_variant(product_id, options={})
|
18
|
-
post("products/#{product_id}/variants/", options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def update_variant(product_id, variant_id, options={})
|
22
|
-
put("products/#{product_id}/variants/#{variant_id}", options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def delete_variant(product_id, variant_id, options={})
|
26
|
-
delete("products/#{product_id}/variants/#{variant_id}", options)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
module API
|
3
|
-
class Client
|
4
|
-
module Zones
|
5
|
-
def zones(options={})
|
6
|
-
get('zones', options)['zones']
|
7
|
-
end
|
8
|
-
|
9
|
-
def zone(id, options={})
|
10
|
-
get("zones/#{id}", options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def new_zone(options={})
|
14
|
-
get("zones/#{id}/new", options)
|
15
|
-
end
|
16
|
-
|
17
|
-
def create_zone(options={})
|
18
|
-
post("zones", options)
|
19
|
-
end
|
20
|
-
|
21
|
-
def update_zone(id, options={})
|
22
|
-
put("zones/#{id}", options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def delete_zone(id, options={})
|
26
|
-
delete("zones/#{id}", options)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/spec/addresses_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Addresses do
|
4
|
-
describe 'address' do
|
5
|
-
it 'should load address' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
address = client.address(1)
|
8
|
-
address.should be_a(Hashie::Mash)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/client_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client do
|
4
|
-
describe ".new" do
|
5
|
-
it "is a Spree::API::Client" do
|
6
|
-
Spree::API::Client.new('http://example.com/api', 'randomtokenstring').should be_a(Spree::API::Client)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'api_endpoint' do
|
11
|
-
it 'should be stored' do
|
12
|
-
client = Spree::API::Client.new('http://example.com/api', 'randomtokenstring')
|
13
|
-
client.api_endpoint.should eql('http://example.com/api')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'api_token' do
|
18
|
-
it 'should be stored' do
|
19
|
-
client = Spree::API::Client.new('http://example.com/api', 'randomtokenstring')
|
20
|
-
client.api_token.should eql('randomtokenstring')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe 'request' do
|
25
|
-
it 'should load stuff from the api' do
|
26
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'randomtokenstring')
|
27
|
-
response = client.request(:get, 'products')
|
28
|
-
response.should be_a(Faraday::Response)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/spec/countries_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Countries do
|
4
|
-
describe 'countries' do
|
5
|
-
it 'should load countries' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
countries = client.countries
|
8
|
-
countries.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/orders_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Orders do
|
4
|
-
describe 'orders' do
|
5
|
-
it 'should load orders' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
orders = client.orders
|
8
|
-
orders.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/payments_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Payments do
|
4
|
-
describe 'payments' do
|
5
|
-
it 'should load payments' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
payments = client.payments('R610162112')
|
8
|
-
payments.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/products_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Products do
|
4
|
-
describe 'products' do
|
5
|
-
it 'should load products' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
products = client.products
|
8
|
-
products.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/properties_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Properties do
|
4
|
-
describe 'properties' do
|
5
|
-
it 'should load properties' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
properties = client.properties(1)
|
8
|
-
properties.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::ReturnAuthorizations do
|
4
|
-
describe 'return_authorizations' do
|
5
|
-
it 'should load return_authorizations' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
return_authorizations = client.return_authorizations('R781501551')
|
8
|
-
return_authorizations.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/shipments_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Shipments do
|
4
|
-
describe 'shipment_ready' do
|
5
|
-
it 'should set a shipment to ready' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
shipment = client.shipment_ready(1, 1)
|
8
|
-
shipment.should be_a(Hashie::Mash)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/taxonomies_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Taxonomies do
|
4
|
-
describe 'taxonomies' do
|
5
|
-
it 'should load taxonomies' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
taxonomies = client.taxonomies
|
8
|
-
taxonomies.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/taxons_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Taxons do
|
4
|
-
describe 'taxons' do
|
5
|
-
it 'should load taxons' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
taxons = client.taxons(1)
|
8
|
-
taxons.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/variants_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Variants do
|
4
|
-
describe 'variants' do
|
5
|
-
it 'should load variants' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
variants = client.variants(1)
|
8
|
-
variants.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spec/zones_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::API::Client::Zones do
|
4
|
-
describe 'zones' do
|
5
|
-
it 'should load zones' do
|
6
|
-
client = Spree::API::Client.new('http://localhost:4000/store/api', 'b56019f04b61a50553ee323f5ab68c6b435871971e79c987')
|
7
|
-
zones = client.zones
|
8
|
-
zones.should be_a(Array)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
data/spree-api-client.gemspec
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'spree-api-client/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "spree-api-client"
|
8
|
-
gem.version = Spree::API::Client::VERSION
|
9
|
-
gem.authors = ["Andrew Nesbitt"]
|
10
|
-
gem.email = ["andrewnez@gmail.com"]
|
11
|
-
gem.description = %q{A rubygem for interacting with the Spree API}
|
12
|
-
gem.summary = %q{A rubygem for interacting with the Spree API}
|
13
|
-
gem.homepage = "https://github.com/andrew/spree-api-client"
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
|
-
|
20
|
-
gem.add_dependency 'faraday', '~> 0.8'
|
21
|
-
gem.add_dependency 'faraday_middleware', '~> 0.9'
|
22
|
-
gem.add_dependency 'hashie', '~> 1.2'
|
23
|
-
gem.add_dependency 'multi_json', '~> 1.3'
|
24
|
-
|
25
|
-
gem.add_development_dependency 'rake'
|
26
|
-
gem.add_development_dependency 'rspec'
|
27
|
-
end
|