weighflow_cli 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.byebug_history +64 -0
- data/Gemfile.lock +1 -1
- data/lib/weighflow_cli.rb +10 -1
- data/lib/weighflow_cli/client.rb +2 -2
- data/lib/weighflow_cli/order_handler.rb +20 -9
- data/lib/weighflow_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0880ba4d3668b12210a21ab60ca40dc37cbefe0e2b18a5cca4465bdda5ca28ba'
|
4
|
+
data.tar.gz: d0bfc91c553fbe48c1f77d1de71ea6427c925ab3300ade47f2a16ba00a2b09ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62f8a787fcd636f2c9dde240d282bec123d558ab7c72a24680a2e1c03a2a9e206779553c2676154b6f8034e4b6516855581fb6192d12dc8b056eb87001973306
|
7
|
+
data.tar.gz: 7a88511b284eadaf3387642a5ee4fb08ece3b8a870f98fb52a9ed357903ac123266670d596ecbdc5da6197a56e75a771b4ec0b1c22bcc0d38291d0b2dcd97791
|
data/.byebug_history
CHANGED
@@ -1,3 +1,67 @@
|
|
1
|
+
c
|
2
|
+
results.first.value
|
3
|
+
results.first.status
|
4
|
+
results.first.methods
|
5
|
+
ap results.first.methods
|
6
|
+
ap results.first.mehtods
|
7
|
+
ap results
|
8
|
+
c
|
9
|
+
ap orders.size
|
10
|
+
n
|
11
|
+
c
|
12
|
+
q
|
13
|
+
c
|
14
|
+
ap results[:commodity_outbounds][:orders]
|
15
|
+
ap results[:commodity_outbounds]
|
16
|
+
ap results.keys
|
17
|
+
ap results.flatten
|
18
|
+
ap results.keys
|
19
|
+
ap results
|
20
|
+
c
|
21
|
+
q
|
22
|
+
c
|
23
|
+
find_orders(selection: 'OI')
|
24
|
+
find_orders(selection: 'OC')
|
25
|
+
self
|
26
|
+
ap auth_headers
|
27
|
+
self
|
28
|
+
c
|
29
|
+
results
|
30
|
+
c
|
31
|
+
ap response.body
|
32
|
+
c
|
33
|
+
ap response.body
|
34
|
+
c
|
35
|
+
ap selection
|
36
|
+
c
|
37
|
+
ap selection
|
38
|
+
c
|
39
|
+
Array[inventory_outbounds[:orders]].compact
|
40
|
+
Array[inventory_outbounds[:orders]]
|
41
|
+
Array.new(inventory_outbounds[:orders])
|
42
|
+
ap inventory_outbounds[:orders]
|
43
|
+
c
|
44
|
+
e
|
45
|
+
n
|
46
|
+
c
|
47
|
+
Array.new(commodity_outbounds[:orders])
|
48
|
+
Array.new(ommodity_outbounds[:orders])
|
49
|
+
Array(ommodity_outbounds[:orders])
|
50
|
+
commodity_outbounds[:orders]
|
51
|
+
ap commodity_outbounds[:orders]
|
52
|
+
Array[commodity_outbounds[:orders]]
|
53
|
+
ap commodity_outbounds[:orders]
|
54
|
+
c
|
55
|
+
ap inventory_outbounds
|
56
|
+
require 'awesome_print'
|
57
|
+
ap inventory_outbounds
|
58
|
+
c
|
59
|
+
ap inventory_outbounds
|
60
|
+
ap commodity_inbounds
|
61
|
+
ap commodity_outbounds
|
62
|
+
require 'awesome_print'
|
63
|
+
ap commodity_outbounds
|
64
|
+
commodity_outbounds
|
1
65
|
q
|
2
66
|
C
|
3
67
|
WeighflowCli::ROOT_PATH
|
data/Gemfile.lock
CHANGED
data/lib/weighflow_cli.rb
CHANGED
@@ -3,10 +3,19 @@
|
|
3
3
|
require 'thor'
|
4
4
|
require 'httparty'
|
5
5
|
|
6
|
+
|
7
|
+
##
|
8
|
+
# Development mode only
|
9
|
+
#
|
10
|
+
if ENV['RUBY_ENV'] == 'development'
|
11
|
+
require 'byebug'
|
12
|
+
require 'awesome_print'
|
13
|
+
end
|
14
|
+
#
|
15
|
+
#
|
6
16
|
require_relative "weighflow_cli/version"
|
7
17
|
require_relative 'weighflow_cli/rendering'
|
8
18
|
require_relative 'weighflow_cli/client'
|
9
|
-
#require_relative 'weighflow_cli/cli_weights'
|
10
19
|
require_relative 'weighflow_cli/cli'
|
11
20
|
require_relative 'weighflow_cli/credentials'
|
12
21
|
require_relative 'weighflow_cli/order_handler'
|
data/lib/weighflow_cli/client.rb
CHANGED
@@ -35,7 +35,7 @@ module WeighflowCli
|
|
35
35
|
end
|
36
36
|
|
37
37
|
|
38
|
-
def commodity_outbound_truck
|
38
|
+
def commodity_outbound_truck
|
39
39
|
find_orders(selection: 'OC')
|
40
40
|
end
|
41
41
|
|
@@ -56,7 +56,7 @@ module WeighflowCli
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def find_orders(selection: 'OC')
|
59
|
-
response = self.class.get('/orders', query: { s: selection })
|
59
|
+
response = self.class.get('/orders', query: { s: selection })
|
60
60
|
render_json(response)
|
61
61
|
end
|
62
62
|
|
@@ -1,30 +1,41 @@
|
|
1
1
|
require 'digest'
|
2
|
+
|
2
3
|
|
3
4
|
|
4
5
|
module WeighflowCli
|
5
6
|
|
6
7
|
module OrderHandler
|
7
|
-
|
8
8
|
#
|
9
9
|
# Pull order data from Weighflow and store in local repository
|
10
10
|
def self.pull
|
11
|
-
|
12
|
-
|
11
|
+
##
|
12
|
+
# api methods to collect orders
|
13
|
+
method_names = [:commodity_outbound_truck,
|
14
|
+
:commodity_inbound_truck,
|
15
|
+
:bulk_inventory_outbound_truck,
|
16
|
+
:bulk_inventory_inbound_truck]
|
13
17
|
#
|
14
|
-
|
15
|
-
|
18
|
+
# collect orders using threads
|
19
|
+
results = threaded_api_query(method_names)
|
16
20
|
#
|
17
|
-
#
|
18
|
-
|
19
|
-
orders = commodity_outbounds[:orders] + commodity_inbounds[:orders] + inventory_outbounds[:orders] + inventory_inbounds[:orders]
|
21
|
+
# flatten order array of hashes
|
22
|
+
orders = results.map { |orders| orders[:orders] }.flatten
|
20
23
|
#
|
24
|
+
# Store in repository
|
21
25
|
diff = OrderRepository.new(orders)
|
22
26
|
diff.perform
|
23
|
-
|
24
27
|
end
|
25
28
|
|
26
29
|
|
30
|
+
##
|
31
|
+
# Process multiple api calls in threads
|
32
|
+
def self.threaded_api_query(method_names)
|
33
|
+
method_names.map do |name|
|
34
|
+
Thread.new { WeighflowCli.client.send(name) }
|
35
|
+
end.map(&:value)
|
36
|
+
end
|
27
37
|
|
38
|
+
|
28
39
|
#
|
29
40
|
#
|
30
41
|
# Find a single order with details from the stored repository
|