item_builder_mwh 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70bb99cadad5391a689c70259b05f3f3213ae32d524d1550975a6949a764b70c
4
- data.tar.gz: 39bf9ce01c2ce41e672c4402f04c1a6b556be61f9f484a0858f6b0acf7be8a4b
3
+ metadata.gz: adb09dbac22b63e6dfbeb1f245139fe29d9b466a1cf5b8563c54a1b9f0fb4449
4
+ data.tar.gz: a34e878b2e286e410ab5d734d518cb35317e4fb3ea2491e3240ae73987a95182
5
5
  SHA512:
6
- metadata.gz: 66fde495aeed2aec031365e2ef00d3976a9137ef05c4fb29a5989ab15b42157898be6de0bdc69b921ecf3978a0fc4b82847d14117b11b4109d21267328dfa7fc
7
- data.tar.gz: dc8bae0552c3b7575ce6ffda7970209bf0c687d7dc5ad08938cda7400807a8445180d97002cfc88f9e1c82be1984fdcc4b5a3735411fbe577b586acc3af44785
6
+ metadata.gz: 8677b4cd7a8a648c769eca378c8f74c76681c5d38a38e9bdb30cd542562d24be8cf58ef147f77e06a4f3bb12ba00d3679b2a2e48848275859a43ef10e81b8192
7
+ data.tar.gz: 06ef4fee31841ee9873c952f0c3b749e6fada70cddd1c04b4728a586aa5e8707c40c1926b2bad40d35be2a16202358392bccfe7afb29c60674acc39310461236
@@ -27,38 +27,6 @@ module ItemBuilderMwh
27
27
  def reserved_stock
28
28
  RestClient.get("#{order_host}?#{reserved_params}")
29
29
  end
30
-
31
- def apigateway_get
32
- RestClient.get("#{host}?#{params}")
33
- end
34
-
35
- def headers
36
- {
37
- content_type: :json,
38
- accept: :json
39
- }
40
- end
41
-
42
- def credential
43
- account_id = listing.profile_channel_association_id
44
- host = ENV['CREDENTIAL_URL'] || 'user.forstok.com'
45
- RestClient.get("#{host}/credential?account_id=#{account_id}")
46
- end
47
-
48
- def data
49
- {
50
- "credential": JSON.parse(credential)['credential'],
51
- "data": request
52
- }
53
- end
54
-
55
- def api_data
56
- data.to_json
57
- end
58
-
59
- def apigateway_post
60
- RestClient.post(url, api_data, headers)
61
- end
62
30
  end
63
31
  end
64
32
  end
@@ -4,7 +4,6 @@ require 'warehouse_models'
4
4
  require 'item_builder_mwh/modes.rb'
5
5
  require 'item_builder_mwh/modes/quantity/base'
6
6
  require 'item_builder_mwh/modes/quantity/lazada_service'
7
- require 'item_builder_mwh/modes/quantity/blibli_service'
8
7
  require 'item_builder_mwh/modes/quantity/zalora_service'
9
8
  module ItemBuilderMwh
10
9
  module Modes
@@ -13,7 +12,6 @@ module ItemBuilderMwh
13
12
 
14
13
  QUANTITY_CHANNEL = {}.tap do |hash|
15
14
  hash[3] = :Lazada
16
- hash[9] = :Blibli
17
15
  hash[13] = :Zalora
18
16
  end.freeze
19
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItemBuilderMwh
4
- VERSION = '0.1.9'
4
+ VERSION = '0.1.10'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item_builder_mwh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ivander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2021-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,7 +128,6 @@ files:
128
128
  - lib/item_builder_mwh/modes/price/zalora_service.rb
129
129
  - lib/item_builder_mwh/modes/price_service.rb
130
130
  - lib/item_builder_mwh/modes/quantity/base.rb
131
- - lib/item_builder_mwh/modes/quantity/blibli_service.rb
132
131
  - lib/item_builder_mwh/modes/quantity/lazada_service.rb
133
132
  - lib/item_builder_mwh/modes/quantity/zalora_service.rb
134
133
  - lib/item_builder_mwh/modes/quantity_service.rb
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'item_builder_mwh/modes/quantity/base'
4
- module ItemBuilderMwh
5
- module Modes
6
- module Quantity
7
- class BlibliService < Base
8
- def perform
9
- local_variant
10
- end
11
-
12
- def local_variant
13
- qty = 0
14
- local_product['value']['items'].each do |item|
15
- qty = total_quantity(item) if item['itemSku'] == listing.local_id
16
- end
17
- qty
18
- end
19
-
20
- def total_quantity(item)
21
- # Make stock 0
22
- # if local reserved quantity is bigger than available quantity
23
- if item['reservedStockLevel2'] > available_quantity
24
- 0
25
- else
26
- available_quantity
27
- end
28
- end
29
-
30
- # Find local product based on id
31
- # @return [Hash] Local Blibli product
32
- def local_product
33
- @local_product ||= JSON.parse(apigateway_post)
34
- end
35
-
36
- private
37
-
38
- def request
39
- {
40
- "gdnSku": listing.local_id
41
- }
42
- end
43
-
44
- def url
45
- url = ENV['API_GATEWAY_URL'] || 'apigateway.forstok.com'
46
- url + '/blibli/item'
47
- end
48
- end
49
- end
50
- end
51
- end