weighflow_cli 0.2.7 → 0.2.8

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: 963cc22724b95f0392a78886af4db5615247fac9c6f2df3d3fe7012b9ff4f5a3
4
- data.tar.gz: 6408e424292209cbaada4f62718a380d4e7052ccb9aadcdf3548e63ed0a7932f
3
+ metadata.gz: d2f3ed43fcfecb4a905c2e58e8e38920002f9267dc151917472bdaca2abad173
4
+ data.tar.gz: 0443ce04de39d02bb39dca8fa908d4dc854c014d359b2b9225e2865511bde5f8
5
5
  SHA512:
6
- metadata.gz: 0db4c48496094db993dd0ea24bd9452e5e61ab2894f406fd2e935030ba5707665ff9a8b86a06425f720dc241b623d0115e80569e34a803703ab3f52b105bce16
7
- data.tar.gz: 6ef4ce49145d58247a5230b3229ef45da023a8abebbd65424e6dfcc01e6e30afb5c6932770bda3971c760e08c6af5c7acadf0ece59a9ce6e97ce990f78affcda
6
+ metadata.gz: 0bf5120b6de638145c148e6ac3b695f1fde406246c04a006933a4b3a9d19a7ac1213a9e7cd12517ec9511f39f1043b02d8222fdcb1931663da3323af7958d1e9
7
+ data.tar.gz: 1bf4768ac5f4e8df1845bea9ecb88d9b9dfb82aa15dc35714bc268a0e4213363fea9a4061b9185e5758a76e4e4f85587d8d45a6e5dab26e7e353fff91e9d907d
data/.byebug_history CHANGED
@@ -1,4 +1,16 @@
1
1
  c
2
+ ap result.first.keys
3
+ ap keys
4
+ q
5
+ c
6
+ uri
7
+ uri.port = 80
8
+ uri.methods
9
+ ap uri
10
+ c
11
+ result.class
12
+ ap result
13
+ c
2
14
  weight_params
3
15
  c
4
16
  weight_params
data/.gitignore CHANGED
@@ -7,6 +7,8 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /.data/*
10
+ /spec/data
11
+
10
12
  # rspec failure tracking
11
13
  .rspec_status
12
14
  .secret.key
data/Gemfile CHANGED
@@ -10,4 +10,6 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
  gem 'awesome_print'
12
12
  gem 'byebug'
13
- gem 'gem-release'
13
+ gem 'gem-release'
14
+ gem 'vcr'
15
+ gem 'webmock'
data/Gemfile.lock CHANGED
@@ -1,17 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weighflow_cli (0.2.6)
4
+ weighflow_cli (0.2.7)
5
5
  httparty
6
6
  thor (~> 1.1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
11
13
  awesome_print (1.8.0)
12
14
  byebug (11.1.3)
15
+ crack (0.4.5)
16
+ rexml
13
17
  diff-lcs (1.4.4)
14
18
  gem-release (2.2.1)
19
+ hashdiff (1.0.1)
15
20
  httparty (0.18.1)
16
21
  mime-types (~> 3.0)
17
22
  multi_xml (>= 0.5.2)
@@ -19,7 +24,9 @@ GEM
19
24
  mime-types-data (~> 3.2015)
20
25
  mime-types-data (3.2021.0225)
21
26
  multi_xml (0.6.0)
27
+ public_suffix (4.0.6)
22
28
  rake (13.0.3)
29
+ rexml (3.2.4)
23
30
  rspec (3.10.0)
24
31
  rspec-core (~> 3.10.0)
25
32
  rspec-expectations (~> 3.10.0)
@@ -34,6 +41,11 @@ GEM
34
41
  rspec-support (~> 3.10.0)
35
42
  rspec-support (3.10.2)
36
43
  thor (1.1.0)
44
+ vcr (6.0.0)
45
+ webmock (3.12.0)
46
+ addressable (>= 2.3.6)
47
+ crack (>= 0.3.2)
48
+ hashdiff (>= 0.4.0, < 2.0.0)
37
49
 
38
50
  PLATFORMS
39
51
  ruby
@@ -45,6 +57,8 @@ DEPENDENCIES
45
57
  gem-release
46
58
  rake (~> 13.0)
47
59
  rspec (~> 3.0)
60
+ vcr
61
+ webmock
48
62
  weighflow_cli!
49
63
 
50
64
  BUNDLED WITH
data/lib/weighflow_cli.rb CHANGED
@@ -20,12 +20,20 @@ module WeighflowCli
20
20
  #
21
21
  Dir.mkdir(_ROOT_PATH) unless Dir.exists?(_ROOT_PATH)
22
22
  #
23
+
23
24
  # Provide an override to relocate data directory
24
- DATA_PATH = ENV['WEIGHFLOW_CLI_PATH'] || File.join(_ROOT_PATH, 'data')
25
- #
26
- #
25
+ def self.data_path
26
+ return @data_path if defined?(@data_path)
27
+ @data_path ||= ENV.fetch('WEIGHFLOW_CLI_PATH') { File.join(_ROOT_PATH, 'data') }
28
+ ensure_data_path
29
+ @data_path
30
+ end
31
+
32
+ ##
27
33
  # Ensure data path
28
- Dir.mkdir(DATA_PATH) unless Dir.exists?(DATA_PATH)
34
+ def self.ensure_data_path
35
+ Dir.mkdir(data_path) unless Dir.exists?(data_path)
36
+ end
29
37
  #
30
38
 
31
39
  Configuration = Struct.new(:secret, :url)
@@ -5,8 +5,7 @@
5
5
 
6
6
  class Cli < Thor
7
7
  include Rendering
8
-
9
-
8
+
10
9
 
11
10
  package_name "WeighflowCli"
12
11
  class_option :yaml, type: :boolean
@@ -26,7 +25,7 @@
26
25
 
27
26
  desc 'data_path', "Current data path"
28
27
  def data_path
29
- puts DATA_PATH
28
+ puts WeighflowCli.data_path
30
29
  end
31
30
 
32
31
 
@@ -21,7 +21,7 @@ module WeighflowCli
21
21
 
22
22
  def create_weight(params: {})
23
23
  response = self.class.post('/weights', body: params)
24
- render_json(response)
24
+ render_json(response)
25
25
  end
26
26
 
27
27
  def void_weight(weight_id, reason)
@@ -64,7 +64,7 @@ module WeighflowCli
64
64
  #
65
65
  # Data index file name
66
66
  def index_file_name
67
- @index_file_name ||= File.join(DATA_PATH, 'orders_index_cache')
67
+ @index_file_name ||= File.join(WeighflowCli.data_path, 'orders_index_cache')
68
68
  end
69
69
 
70
70
 
@@ -85,7 +85,7 @@ module WeighflowCli
85
85
  #
86
86
  # Build the file name from the checksum
87
87
  def build_detail_file_name(order)
88
- File.join(DATA_PATH, 'order_' + create_checksum(order) + '.json')
88
+ File.join(WeighflowCli.data_path, 'order_' + create_checksum(order) + '.json')
89
89
  end
90
90
 
91
91
 
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  module WeighflowCli
6
- VERSION = "0.2.7"
6
+ VERSION = "0.2.8"
7
7
 
8
8
 
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weighflow_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruce Martin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-27 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor