arctic-vendor 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +15 -0
- data/lib/arctic/vendor/api.rb +10 -0
- data/lib/arctic/vendor/vendor.rb +2 -0
- data/lib/arctic/vendor/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e678ef652c084b21fd6bfe28c2c7cdbb7adf5d63a59abdf2fe280c9a2db382cb
|
4
|
+
data.tar.gz: d6523f7bcb738e8822357804cb1d71739c2eb297b5f4d66f29742501497afc28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fd4296d9bf46ce2417378e99e4fba962a730ac4eb07df1083d3368f187676f6c387cde0b359ab68ab29f705eae1ed53a41a7b5a891ea366a170837d49ae7d2e
|
7
|
+
data.tar.gz: 49c7f80fe637630f9bd2305f795feb5eeb4e5dce04caadc9c9e922294d551e5247d3818880b28dea110d7ce157364a0f5e8a5c8e99c983580e8d643ba1cdb028
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -14,6 +14,7 @@ Then in your code:
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
require 'bundler/setup'
|
17
|
+
require 'arctic/vendor'
|
17
18
|
|
18
19
|
module Arctic
|
19
20
|
module Vendor
|
@@ -36,6 +37,20 @@ module Arctic
|
|
36
37
|
end
|
37
38
|
```
|
38
39
|
|
40
|
+
Then in your Rakefile:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
require_relative "./path/to/your/lib"
|
44
|
+
|
45
|
+
desc "Sync"
|
46
|
+
task :sync do
|
47
|
+
# You can skip either of these if the vendor doesn't support either pulling or
|
48
|
+
# pushing products and orders.
|
49
|
+
Arctic::Vendor::Dandomain.collect_products
|
50
|
+
Arctic::Vendor::Dandomain.distribute_products
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
39
54
|
## Testing
|
40
55
|
|
41
56
|
Run all the tests:
|
data/lib/arctic/vendor/api.rb
CHANGED
@@ -44,6 +44,16 @@ module Arctic
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
# Retrieve products from the Core API
|
48
|
+
def list_products(account_id, shop_id)
|
49
|
+
make_request :get, "accounts/#{account_id}/shops/#{shop_id}/products"
|
50
|
+
end
|
51
|
+
|
52
|
+
# Marks the shop as synchronized by the vendor
|
53
|
+
def synchronized(account_id, shop_id)
|
54
|
+
make_request :put, "accounts/#{account_id}/shops/#{shop_id}/synchronized"
|
55
|
+
end
|
56
|
+
|
47
57
|
private
|
48
58
|
|
49
59
|
def make_batch_request(*args, **options)
|
data/lib/arctic/vendor/vendor.rb
CHANGED
@@ -45,6 +45,7 @@ module Arctic
|
|
45
45
|
each_shop do |shop, account|
|
46
46
|
products = api.send_products account['id'], shop['id'], yield(shop)
|
47
47
|
products_count += products.size
|
48
|
+
api.synchronized account['id'], shop['id']
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
@@ -63,6 +64,7 @@ module Arctic
|
|
63
64
|
products = api.list_products account['id'], shop['id']
|
64
65
|
products_count += products.size
|
65
66
|
yield shop, products
|
67
|
+
api.synchronized account['id'], shop['id']
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arctic-vendor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Kampp
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- ".gitignore"
|
92
92
|
- ".rspec"
|
93
93
|
- ".travis.yml"
|
94
|
+
- CHANGELOG.md
|
94
95
|
- Gemfile
|
95
96
|
- Gemfile.lock
|
96
97
|
- LICENSE.txt
|