QNE 0.6.0 → 0.7.1

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: 47c9caa8f42e5d76c0e50f3ca35bbae61832bcb2c06cdf2532724f580576ade1
4
- data.tar.gz: 28439fa6d39bc3223cf4c54841e14248188764da2137f2724bb5687123826a82
3
+ metadata.gz: 2babe79332b2cb68b2728bdb74b1ae9515067ae3ce9e4c9264f055d3f48a8883
4
+ data.tar.gz: cd638f8b27b31ec8486e6e59e813472d177f0767c3879f247f468817e5bc67f6
5
5
  SHA512:
6
- metadata.gz: b199c7603bc8b76ba82da3af5c68381cf98640c10e14f8c7021e60362fcb44b69336c474d3ff6b7908aa71b903736b6497349c0296cf5b97f98fc790c97c6de3
7
- data.tar.gz: ec57eb1587743d48af312d47f69549280e00fd4fd86f38b06e0f151614f85440703844d6a8924aa112503ec2c1965db6b9ac52614b541994bdc9600fc10e33ec
6
+ metadata.gz: b1ef31b2e8127eb29204c7287c80576149c151725010700410e3bbf4c43a0d0ff9c2f825febe49623a37e8cffa94d6b4f62d23105c2b5540b2d2f69f0afaaacc
7
+ data.tar.gz: 03a795ec899b3ff415a4506a0fb89a6947f994d46d48c376993b1c104821ae490590f292109371a71eccb34118150288dd04279eb1c019402b744563ede49cc3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- QNE (0.5.2)
4
+ QNE (0.7.0)
5
5
  faraday (>= 1.10)
6
6
  faraday-net_http_persistent (>= 1.2)
7
7
  faraday-retry
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.8.8)
13
+ addressable (2.8.9)
14
14
  public_suffix (>= 2.0.2, < 8.0)
15
15
  ast (2.4.3)
16
16
  bigdecimal (4.0.1)
@@ -19,7 +19,7 @@ GEM
19
19
  bigdecimal
20
20
  rexml
21
21
  diff-lcs (1.6.2)
22
- faraday (2.14.0)
22
+ faraday (2.14.1)
23
23
  faraday-net_http (>= 2.0, < 3.5)
24
24
  json
25
25
  logger
@@ -31,19 +31,24 @@ GEM
31
31
  faraday-retry (2.4.0)
32
32
  faraday (~> 2.0)
33
33
  hashdiff (1.2.1)
34
- json (2.18.0)
34
+ json (2.18.1)
35
+ json-schema (6.1.0)
36
+ addressable (~> 2.8)
37
+ bigdecimal (>= 3.1, < 5)
35
38
  language_server-protocol (3.17.0.5)
36
39
  lint_roller (1.1.0)
37
40
  logger (1.7.0)
41
+ mcp (0.7.1)
42
+ json-schema (>= 4.1)
38
43
  net-http (0.9.1)
39
44
  uri (>= 0.11.1)
40
45
  net-http-persistent (4.0.8)
41
46
  connection_pool (>= 2.2.4, < 4)
42
47
  parallel (1.27.0)
43
- parser (3.3.10.1)
48
+ parser (3.3.10.2)
44
49
  ast (~> 2.4.1)
45
50
  racc
46
- prism (1.8.0)
51
+ prism (1.9.0)
47
52
  public_suffix (7.0.2)
48
53
  racc (1.8.1)
49
54
  rainbow (3.1.1)
@@ -59,19 +64,20 @@ GEM
59
64
  rspec-expectations (3.13.5)
60
65
  diff-lcs (>= 1.2.0, < 2.0)
61
66
  rspec-support (~> 3.13.0)
62
- rspec-mocks (3.13.7)
67
+ rspec-mocks (3.13.8)
63
68
  diff-lcs (>= 1.2.0, < 2.0)
64
69
  rspec-support (~> 3.13.0)
65
- rspec-support (3.13.6)
66
- rubocop (1.82.1)
70
+ rspec-support (3.13.7)
71
+ rubocop (1.85.0)
67
72
  json (~> 2.3)
68
73
  language_server-protocol (~> 3.17.0.2)
69
74
  lint_roller (~> 1.1.0)
75
+ mcp (~> 0.6)
70
76
  parallel (~> 1.10)
71
77
  parser (>= 3.3.0.2)
72
78
  rainbow (>= 2.2.2, < 4.0)
73
79
  regexp_parser (>= 2.9.3, < 3.0)
74
- rubocop-ast (>= 1.48.0, < 2.0)
80
+ rubocop-ast (>= 1.49.0, < 2.0)
75
81
  ruby-progressbar (~> 1.7)
76
82
  unicode-display_width (>= 2.4.0, < 4.0)
77
83
  rubocop-ast (1.49.0)
data/README.md CHANGED
@@ -382,6 +382,18 @@ conn.stock_locations.all
382
382
 
383
383
  _Note: `filters` and `queries` won't work for this specific action._
384
384
 
385
+ ### Stock Reports
386
+
387
+ **1. Fetch all stocks reports available balance by date**
388
+
389
+ ```ruby
390
+ conn.stock_reports.find_stocks_location_balance_by_date
391
+ ```
392
+
393
+ ```ruby
394
+ conn.stock_reports.find_stocks_location_balance_by_date(as_of_date: Time.current, stock_location: 'AL')
395
+ ```
396
+
385
397
  ### Terms
386
398
 
387
399
  **1. Fetch all terms**
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QNE
4
+ module StockReport
5
+ class StockLocationBalance
6
+ PATH = '/api/StockReports/StockLocationBalance'
7
+
8
+ def initialize(conn, as_of_date)
9
+ @conn = conn
10
+ @as_of_date = as_of_date.strftime('%Y-%m-%d')
11
+ end
12
+
13
+ def call
14
+ params = "?asOfDate=#{@as_of_date}"
15
+ @conn.get(PATH + params)
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/QNE/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QNE
4
- VERSION = '0.6.0'
4
+ VERSION = '0.7.1'
5
5
  end
data/lib/connection.rb CHANGED
@@ -7,6 +7,7 @@ require_relative 'default_tax_code'
7
7
  require_relative 'sales_invoices'
8
8
  require_relative 'sales_orders'
9
9
  require_relative 'stocks'
10
+ require_relative 'stock_reports'
10
11
  require_relative 'stock_locations'
11
12
  require_relative 'system_version'
12
13
  require_relative 'terms'
@@ -57,6 +58,10 @@ module QNE
57
58
  @stocks ||= QNE::Stocks.new(connection)
58
59
  end
59
60
 
61
+ def stock_reports
62
+ @stock_reports ||= QNE::StockReports.new(connection)
63
+ end
64
+
60
65
  def terms
61
66
  @terms ||= QNE::Terms.new(connection)
62
67
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'QNE/stock_report/stock_location_balance'
4
+
5
+ module QNE
6
+ class StockReports < Base
7
+ include ::QNE::QueryBuilder
8
+
9
+ def find_stocks_location_balance_by_date(as_of_date: Date.today, stock_location: nil)
10
+ @response = QNE::StockReport::StockLocationBalance.new(
11
+ conn, as_of_date
12
+ ).call
13
+
14
+ parsed = parse_to_json(response.body)
15
+
16
+ # Handle API error response
17
+ return parsed if parsed.is_a?(Hash)
18
+
19
+ if stock_location.present?
20
+ parsed.select { |stock| stock['locationCode'] == stock_location }
21
+ else
22
+ parsed
23
+ end
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: QNE
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nujian Den Mark Meralpis
@@ -119,6 +119,7 @@ files:
119
119
  - lib/QNE/stock/find.rb
120
120
  - lib/QNE/stock/uoms.rb
121
121
  - lib/QNE/stock_location/all.rb
122
+ - lib/QNE/stock_report/stock_location_balance.rb
122
123
  - lib/QNE/tax_code/all.rb
123
124
  - lib/QNE/tax_code/input_tax_codes.rb
124
125
  - lib/QNE/tax_code/output_tax_codes.rb
@@ -137,6 +138,7 @@ files:
137
138
  - lib/sales_invoices.rb
138
139
  - lib/sales_orders.rb
139
140
  - lib/stock_locations.rb
141
+ - lib/stock_reports.rb
140
142
  - lib/stocks.rb
141
143
  - lib/system_version.rb
142
144
  - lib/tax_codes.rb