arctic-vendor 0.2.0 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9359da6082ae7c7fc50362ab929dc38e896040830bc3f33bbe517e2d6ec217dd
4
- data.tar.gz: 3733d68f7024aab3a01ee58e614d4f9ca622b7527dc6ee449970e784e14647af
3
+ metadata.gz: e678ef652c084b21fd6bfe28c2c7cdbb7adf5d63a59abdf2fe280c9a2db382cb
4
+ data.tar.gz: d6523f7bcb738e8822357804cb1d71739c2eb297b5f4d66f29742501497afc28
5
5
  SHA512:
6
- metadata.gz: 54481eebbee5d58e2bab61301a40255748983de6ebc1c2da558be27cfc7fbf746689c629a26aef552658f89f23d1c5badbb3a17df065588a697836cfc05ee61a
7
- data.tar.gz: 89b83381f1bc256d318f67af0ff3d60715a529860b96f4e452b1d5746c0c1b85510b1f6ace433ca666807d62e77cedf9a9fa501eaaa7142b553e161c7c3ceab6
6
+ metadata.gz: 3fd4296d9bf46ce2417378e99e4fba962a730ac4eb07df1083d3368f187676f6c387cde0b359ab68ab29f705eae1ed53a41a7b5a891ea366a170837d49ae7d2e
7
+ data.tar.gz: 49c7f80fe637630f9bd2305f795feb5eeb4e5dce04caadc9c9e922294d551e5247d3818880b28dea110d7ce157364a0f5e8a5c8e99c983580e8d643ba1cdb028
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ### 0.2.1
4
+
5
+ * Added Arctic::Vendor::API#list_products method to allow vendors to retrieve products from the Core API - Emil Kampp <emil@youwe.dk>
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arctic-vendor (0.1.0)
4
+ arctic-vendor (0.2.1)
5
5
  activesupport (~> 5.2)
6
6
  faraday (~> 0.14)
7
7
 
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:
@@ -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)
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Arctic
2
2
  module Vendor
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
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.0
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-22 00:00:00.000000000 Z
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