QNE 0.5.2 → 0.7.0

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: 5a03fcd46a6306a4b0e8e18433b0d60cdaaea726c28e0123c98d81f419a4bcfa
4
- data.tar.gz: 28dee7da9e164b9c25d3daf21ed1764922ba1ffc3f61148babb70653de140e57
3
+ metadata.gz: '09370058db0c46e32d7127778941eadf39eff5a95d562c2bf98e180a473d19e0'
4
+ data.tar.gz: dfc85a8e1b754302b9ccb6e10e82372a6bdbdfe59229ddbd6a56a696337079e0
5
5
  SHA512:
6
- metadata.gz: 28554d4627be68ffd0e94353c7c15763d8286fdc2bbeaf76401aecaadc8792bd71bb6f4f0b51bdafbb894b0d842e50b94a84272adf2bc947365b7495e9a2f644
7
- data.tar.gz: b56aea0997738e4f4ef37d4441fb5dfe6c6995aa81aa330ee3cb2cca63a6e71ed17c45e843a6e6f6821661d68ed019693b80fafdcb95caccee5711b1dc2d870b
6
+ metadata.gz: 31f912a24415c8a3ad9d8f69b0c274976fd4d3654d4f41802244c80135df17f81998512bf8fc1a6050f61c651dd417ee8cfdd63cf27746df8ed31ececfc4c363
7
+ data.tar.gz: a269f96d5ca55adc9f8cc0b2295e0c77b4449d14a4d69728dab5206cf8001ae358635df7bd6404b73ece6ed35c837f13f8bcbddb8be1502268b43f1897e40c2e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- QNE (0.5.1)
4
+ QNE (0.7.0)
5
5
  faraday (>= 1.10)
6
6
  faraday-net_http_persistent (>= 1.2)
7
7
  faraday-retry
@@ -10,41 +10,46 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.8.7)
14
- public_suffix (>= 2.0.2, < 7.0)
13
+ addressable (2.8.9)
14
+ public_suffix (>= 2.0.2, < 8.0)
15
15
  ast (2.4.3)
16
- bigdecimal (3.3.1)
17
- connection_pool (2.5.4)
16
+ bigdecimal (4.0.1)
17
+ connection_pool (3.0.2)
18
18
  crack (1.0.1)
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
26
- faraday-net_http (3.4.1)
27
- net-http (>= 0.5.0)
26
+ faraday-net_http (3.4.2)
27
+ net-http (~> 0.5)
28
28
  faraday-net_http_persistent (2.3.1)
29
29
  faraday (~> 2.5)
30
30
  net-http-persistent (>= 4.0.4, < 5)
31
- faraday-retry (2.3.2)
31
+ faraday-retry (2.4.0)
32
32
  faraday (~> 2.0)
33
33
  hashdiff (1.2.1)
34
- json (2.15.2)
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)
38
- net-http (0.7.0)
39
- uri
40
- net-http-persistent (4.0.6)
41
- connection_pool (~> 2.2, >= 2.2.4)
41
+ mcp (0.7.1)
42
+ json-schema (>= 4.1)
43
+ net-http (0.9.1)
44
+ uri (>= 0.11.1)
45
+ net-http-persistent (4.0.8)
46
+ connection_pool (>= 2.2.4, < 4)
42
47
  parallel (1.27.0)
43
- parser (3.3.10.0)
48
+ parser (3.3.10.2)
44
49
  ast (~> 2.4.1)
45
50
  racc
46
- prism (1.6.0)
47
- public_suffix (6.0.2)
51
+ prism (1.9.0)
52
+ public_suffix (7.0.2)
48
53
  racc (1.8.1)
49
54
  rainbow (3.1.1)
50
55
  rake (13.3.1)
@@ -59,28 +64,29 @@ 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.81.7)
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.47.1, < 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
- rubocop-ast (1.47.1)
83
+ rubocop-ast (1.49.0)
78
84
  parser (>= 3.3.7.2)
79
- prism (~> 1.4)
85
+ prism (~> 1.7)
80
86
  ruby-progressbar (1.13.0)
81
87
  unicode-display_width (3.2.0)
82
88
  unicode-emoji (~> 4.1)
83
- unicode-emoji (4.1.0)
89
+ unicode-emoji (4.2.0)
84
90
  uri (1.1.1)
85
91
  webmock (3.26.1)
86
92
  addressable (>= 2.8.0)
data/README.md CHANGED
@@ -366,6 +366,12 @@ stock = conn.stocks.find('stock-id')
366
366
  stock.show
367
367
  ```
368
368
 
369
+ **4. Fetch specific stock available using stock_code**
370
+
371
+ ```ruby
372
+ stock = conn.stocks.find_stocks_available_by_stock_code('stock_code')
373
+ ```
374
+
369
375
  ### Stock Locations
370
376
 
371
377
  **1. Fetch all stock locations**
@@ -376,6 +382,18 @@ conn.stock_locations.all
376
382
 
377
383
  _Note: `filters` and `queries` won't work for this specific action._
378
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)
395
+ ```
396
+
379
397
  ### Terms
380
398
 
381
399
  **1. Fetch all terms**
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QNE
4
+ module Stock
5
+ class Available
6
+ PATH = '/api/Stocks/available'
7
+
8
+ def initialize(conn, stock_code:)
9
+ @conn = conn
10
+ @stock_code = stock_code
11
+ end
12
+
13
+ def call
14
+ params = "?code=#{@stock_code}"
15
+ @conn.get(PATH + params)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -5,12 +5,17 @@ module QNE
5
5
  class All
6
6
  PATH = '/api/StockLocation'
7
7
 
8
- def initialize(conn)
8
+ def initialize(conn, params: {})
9
9
  @conn = conn
10
+ @params = params
10
11
  end
11
12
 
12
13
  def call
13
- @conn.get(PATH)
14
+ @conn.get(PATH) do |req|
15
+ @params.each do |key, val|
16
+ req.params[key] = val
17
+ end
18
+ end
14
19
  end
15
20
  end
16
21
  end
@@ -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.5.2'
4
+ VERSION = '0.7.0'
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,17 @@
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)
10
+ @response = QNE::StockReport::StockLocationBalance.new(
11
+ conn, as_of_date
12
+ ).call
13
+
14
+ parse_to_json(@response.body)
15
+ end
16
+ end
17
+ end
data/lib/stocks.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative 'QNE/stock/all'
4
4
  require_relative 'QNE/stock/uoms'
5
5
  require_relative 'QNE/stock/find'
6
+ require_relative 'QNE/stock/available'
6
7
 
7
8
  module QNE
8
9
  class Stocks < Base
@@ -41,5 +42,13 @@ module QNE
41
42
 
42
43
  parse_to_json(@response.body)
43
44
  end
45
+
46
+ def find_stocks_available_by_stock_code(stock_code)
47
+ @response = QNE::Stock::Available.new(
48
+ conn, stock_code: stock_code
49
+ ).call
50
+
51
+ parse_to_json(@response.body)
52
+ end
44
53
  end
45
54
  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.5.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nujian Den Mark Meralpis
@@ -115,9 +115,11 @@ files:
115
115
  - lib/QNE/sales_order/create.rb
116
116
  - lib/QNE/sales_order/show.rb
117
117
  - lib/QNE/stock/all.rb
118
+ - lib/QNE/stock/available.rb
118
119
  - lib/QNE/stock/find.rb
119
120
  - lib/QNE/stock/uoms.rb
120
121
  - lib/QNE/stock_location/all.rb
122
+ - lib/QNE/stock_report/stock_location_balance.rb
121
123
  - lib/QNE/tax_code/all.rb
122
124
  - lib/QNE/tax_code/input_tax_codes.rb
123
125
  - lib/QNE/tax_code/output_tax_codes.rb
@@ -136,6 +138,7 @@ files:
136
138
  - lib/sales_invoices.rb
137
139
  - lib/sales_orders.rb
138
140
  - lib/stock_locations.rb
141
+ - lib/stock_reports.rb
139
142
  - lib/stocks.rb
140
143
  - lib/system_version.rb
141
144
  - lib/tax_codes.rb