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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/LICENSE.txt +674 -0
  4. data/README.md +31 -38
  5. data/lib/spree_client.rb +3 -0
  6. data/lib/spree_client.rb~ +71 -0
  7. data/lib/spree_client/api.rb +1 -0
  8. data/lib/spree_client/api/v1.rb +53 -0
  9. data/lib/spree_client/api/v1/products.rb +23 -0
  10. data/lib/spree_client/api/v1/properties.rb +12 -0
  11. data/lib/spree_client/api/v1/resources.rb +142 -0
  12. data/lib/spree_client/api/v1/stock_items.rb +27 -0
  13. data/lib/spree_client/api/v1/stock_locations.rb +33 -0
  14. data/lib/spree_client/api/v1/stock_movements.rb +16 -0
  15. data/lib/spree_client/api/v1/taxonomies.rb +12 -0
  16. data/lib/spree_client/api/v1/variants.rb +13 -0
  17. data/lib/spree_client/attributes.rb +27 -0
  18. data/lib/spree_client/models.rb +5 -0
  19. data/lib/spree_client/models/product.rb +7 -0
  20. data/lib/spree_client/models/property.rb +6 -0
  21. data/lib/spree_client/models/stock_item.rb +7 -0
  22. data/lib/spree_client/models/stock_location.rb +7 -0
  23. data/lib/spree_client/models/stock_movement.rb +7 -0
  24. data/lib/spree_client/models/store.rb +7 -0
  25. data/lib/spree_client/models/taxonomy.rb +5 -0
  26. data/lib/spree_client/models/variant.rb +7 -0
  27. metadata +79 -118
  28. data/.gitignore +0 -17
  29. data/.travis.yml +0 -9
  30. data/CONTRIBUTING.md +0 -8
  31. data/Gemfile +0 -3
  32. data/LICENSE +0 -22
  33. data/Rakefile +0 -7
  34. data/lib/spree-api-client.rb +0 -49
  35. data/lib/spree-api-client/addresses.rb +0 -15
  36. data/lib/spree-api-client/connection.rb +0 -30
  37. data/lib/spree-api-client/countries.rb +0 -15
  38. data/lib/spree-api-client/line_items.rb +0 -19
  39. data/lib/spree-api-client/orders.rb +0 -31
  40. data/lib/spree-api-client/payments.rb +0 -43
  41. data/lib/spree-api-client/products.rb +0 -31
  42. data/lib/spree-api-client/properties.rb +0 -31
  43. data/lib/spree-api-client/request.rb +0 -49
  44. data/lib/spree-api-client/return_authorizations.rb +0 -31
  45. data/lib/spree-api-client/shipments.rb +0 -15
  46. data/lib/spree-api-client/taxonomies.rb +0 -31
  47. data/lib/spree-api-client/taxons.rb +0 -27
  48. data/lib/spree-api-client/variants.rb +0 -31
  49. data/lib/spree-api-client/version.rb +0 -7
  50. data/lib/spree-api-client/zones.rb +0 -31
  51. data/spec/addresses_spec.rb +0 -11
  52. data/spec/client_spec.rb +0 -31
  53. data/spec/countries_spec.rb +0 -11
  54. data/spec/orders_spec.rb +0 -11
  55. data/spec/payments_spec.rb +0 -11
  56. data/spec/products_spec.rb +0 -11
  57. data/spec/properties_spec.rb +0 -11
  58. data/spec/return_authorizations_spec.rb +0 -11
  59. data/spec/shipments_spec.rb +0 -11
  60. data/spec/spec_helper.rb +0 -5
  61. data/spec/taxonomies_spec.rb +0 -11
  62. data/spec/taxons_spec.rb +0 -11
  63. data/spec/variants_spec.rb +0 -11
  64. data/spec/zones_spec.rb +0 -11
  65. 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,7 +0,0 @@
1
- module Spree
2
- module API
3
- class Client
4
- VERSION = "0.0.1"
5
- end
6
- end
7
- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,5 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'spree-api-client'
4
- require 'rspec'
5
- # require 'webmock/rspec'
@@ -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
@@ -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
@@ -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