QNE 0.7.2 → 0.9.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: 7d2294ee72229714228a5183fe7a95bada237cad1c655cd2d327a399e4ad7e77
4
- data.tar.gz: eb80c566f86f125d42b7842be165c54ec06e79e2eb609e453e5c60309b33b97e
3
+ metadata.gz: 005b4b681b57f747b4facfa512ba79d6613fd8a0b854bdaba728490b66e73ded
4
+ data.tar.gz: c65fd9566cf9f484a429a506a8bf779f21fb5ef5154f8323980d68712e646b08
5
5
  SHA512:
6
- metadata.gz: ef3b819fe2aa9d1e67c73c2ab208fbdfcd2dcb5f485d70298ae69b1d0be7c5f6008f4e86353e5300b0ec431bb8c6f3c07f5b4899e8347ee37df36da23e194582
7
- data.tar.gz: 37cf6a3b2df8f0cf69e86de88f8b538bdde4ce0cadabea117173cf381723358ac10ceaded61e535ea5cfc2f8450d56c787cf717a5fc386ff66e0a1759434da4e
6
+ metadata.gz: 35292c61522f77d4f9048990c677a37300c6c6130851efbcaa62bf8d21216e50236d656d80128adc6dcc0613f27cd3803191f907535fdc7213bfe75b4943ab5a
7
+ data.tar.gz: 9c1a2578c61abcdd8d18cd0e8ba5cbc596171a73b85fd908d2eef893c6ea24ea3f105023bc7d38bb2aeaa18373e56f8a42b2d353e9035fc52c485aef99b13954
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.0] - 2026-09-29
9
+
10
+ - Support connecting to a local QNE server: `Connection` now accepts `app_port` and `proxy` options, and when both are set, requests go to `<proxy>:<app_port>` instead of the cloud `BASE_URI` (an `http://` scheme is added when the proxy has none, and trailing slashes are removed)
11
+ - Bump regexp_parser, unicode-display_width, and unicode-emoji dependency versions
12
+
13
+ ## [0.8.0] - 2026-09-16
14
+
15
+ - Add Customer Receipts resource (`Connection#customer_receipts`) with a `create` method that posts to `/api/CustomerReceipts`
16
+ - Bump bigdecimal, faraday, json (2.x → 3.x), parallel, rubocop, and webmock dependency versions
17
+
8
18
  ## [0.7.2] - 2026-07-28
9
19
 
10
20
  - Bump json, parser, and rubocop dependency versions
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- QNE (0.7.2)
4
+ QNE (0.9.0)
5
5
  faraday (>= 1.10)
6
6
  faraday-net_http_persistent (>= 1.2)
7
7
  faraday-retry
@@ -13,13 +13,13 @@ GEM
13
13
  addressable (2.9.0)
14
14
  public_suffix (>= 2.0.2, < 8.0)
15
15
  ast (2.4.3)
16
- bigdecimal (4.1.2)
16
+ bigdecimal (4.1.3)
17
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.3)
22
+ faraday (2.14.4)
23
23
  faraday-net_http (>= 2.0, < 3.5)
24
24
  json
25
25
  logger
@@ -31,7 +31,7 @@ GEM
31
31
  faraday-retry (2.4.0)
32
32
  faraday (~> 2.0)
33
33
  hashdiff (1.2.1)
34
- json (2.21.1)
34
+ json (3.0.2)
35
35
  language_server-protocol (3.17.0.6)
36
36
  lint_roller (1.1.0)
37
37
  logger (1.7.0)
@@ -39,7 +39,7 @@ GEM
39
39
  uri (>= 0.11.1)
40
40
  net-http-persistent (4.0.8)
41
41
  connection_pool (>= 2.2.4, < 4)
42
- parallel (2.1.0)
42
+ parallel (2.2.0)
43
43
  parser (3.3.12.0)
44
44
  ast (~> 2.4.1)
45
45
  racc
@@ -48,7 +48,7 @@ GEM
48
48
  racc (1.8.1)
49
49
  rainbow (3.1.1)
50
50
  rake (13.4.2)
51
- regexp_parser (2.12.0)
51
+ regexp_parser (2.13.1)
52
52
  rexml (3.4.4)
53
53
  rspec (3.13.2)
54
54
  rspec-core (~> 3.13.0)
@@ -63,8 +63,8 @@ GEM
63
63
  diff-lcs (>= 1.2.0, < 2.0)
64
64
  rspec-support (~> 3.13.0)
65
65
  rspec-support (3.13.7)
66
- rubocop (1.88.2)
67
- json (~> 2.3)
66
+ rubocop (1.91.0)
67
+ json (>= 2.3)
68
68
  language_server-protocol (~> 3.17.0.2)
69
69
  lint_roller (~> 1.1.0)
70
70
  parallel (>= 1.10)
@@ -78,11 +78,11 @@ GEM
78
78
  parser (>= 3.3.7.2)
79
79
  prism (~> 1.7)
80
80
  ruby-progressbar (1.13.0)
81
- unicode-display_width (3.2.0)
82
- unicode-emoji (~> 4.1)
83
- unicode-emoji (4.2.0)
81
+ unicode-display_width (3.3.0)
82
+ unicode-emoji (~> 4.3)
83
+ unicode-emoji (4.3.0)
84
84
  uri (1.1.1)
85
- webmock (3.26.2)
85
+ webmock (3.26.4)
86
86
  addressable (>= 2.8.0)
87
87
  crack (>= 0.3.2)
88
88
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QNE
4
+ module CustomerReceipt
5
+ class Create
6
+ PATH = '/api/CustomerReceipts'
7
+
8
+ def initialize(conn, request_body:)
9
+ @conn = conn
10
+ @request_body = request_body
11
+ end
12
+
13
+ def call
14
+ @conn.post(PATH) do |req|
15
+ req.headers['Content-Type'] = 'application/json'
16
+ req.body = @request_body.to_json
17
+ end
18
+ end
19
+ end
20
+ end
21
+ 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.7.2'
4
+ VERSION = '0.9.0'
5
5
  end
data/lib/connection.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require_relative 'agents'
4
4
  require_relative 'customers'
5
5
  require_relative 'customer_categories'
6
+ require_relative 'customer_receipts'
6
7
  require_relative 'default_tax_code'
7
8
  require_relative 'sales_invoices'
8
9
  require_relative 'sales_orders'
@@ -15,6 +16,7 @@ require_relative 'uoms'
15
16
  require_relative 'tax_codes'
16
17
  require_relative 'users'
17
18
 
19
+ # rubocop:disable Metrics/ClassLength
18
20
  module QNE
19
21
  class Connection
20
22
  BASE_URI = 'https://dev-api.qne.cloud'
@@ -23,6 +25,7 @@ module QNE
23
25
  def initialize(options = {}, &retry_block)
24
26
  @db_code = options.fetch(:db_code, nil) || ENV['QNE_DB_CODE']
25
27
  @api_token = options.fetch(:api_token, nil)
28
+ @app_port, @proxy = options.values_at(:app_port, :proxy)
26
29
  @retry_block = retry_block
27
30
  end
28
31
 
@@ -42,6 +45,10 @@ module QNE
42
45
  @customer_categories ||= QNE::CustomerCategories.new(connection)
43
46
  end
44
47
 
48
+ def customer_receipts
49
+ @customer_receipts ||= QNE::CustomerReceipts.new(connection)
50
+ end
51
+
45
52
  def default_tax_code
46
53
  @default_tax_code ||= QNE::DefaultTaxCode.new(connection).call
47
54
  end
@@ -79,7 +86,7 @@ module QNE
79
86
  end
80
87
 
81
88
  def users
82
- @users ||= QNE::Users.new(Faraday.new(url: BASE_URI))
89
+ @users ||= QNE::Users.new(Faraday.new(url: base_uri))
83
90
  end
84
91
 
85
92
  def connected?
@@ -105,12 +112,20 @@ module QNE
105
112
 
106
113
  def faraday_params
107
114
  @faraday_params ||= {
108
- url: BASE_URI,
115
+ url: base_uri,
109
116
  headers: auth_method,
110
117
  request: request_options
111
118
  }
112
119
  end
113
120
 
121
+ def base_uri
122
+ return BASE_URI if @app_port.to_s.strip.empty? || @proxy.to_s.strip.empty?
123
+
124
+ proxy = @proxy.to_s.strip.sub(%r{/*\z}, '').sub(%r{\A(?!https?://)}i, 'http://')
125
+
126
+ "#{proxy}:#{@app_port}"
127
+ end
128
+
114
129
  def retry_options
115
130
  @retry_options ||= {
116
131
  retry_statuses: [401, 409, 500],
@@ -142,3 +157,4 @@ module QNE
142
157
  end
143
158
  end
144
159
  end
160
+ # rubocop:enable Metrics/ClassLength
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'QNE/customer_receipt/create'
4
+
5
+ module QNE
6
+ class CustomerReceipts < Base
7
+ include ::QNE::QueryBuilder
8
+
9
+ def create(request_body)
10
+ @response = QNE::CustomerReceipt::Create.new(
11
+ conn, request_body: request_body
12
+ ).call
13
+
14
+ parse_to_json(@response.body)
15
+ end
16
+ end
17
+ 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.7.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nujian Den Mark Meralpis
@@ -105,6 +105,7 @@ files:
105
105
  - lib/QNE/customer/show.rb
106
106
  - lib/QNE/customer/update.rb
107
107
  - lib/QNE/customer_category/all.rb
108
+ - lib/QNE/customer_receipt/create.rb
108
109
  - lib/QNE/sales_invoice/all.rb
109
110
  - lib/QNE/sales_invoice/create.rb
110
111
  - lib/QNE/sales_invoice/download.rb
@@ -132,6 +133,7 @@ files:
132
133
  - lib/base.rb
133
134
  - lib/connection.rb
134
135
  - lib/customer_categories.rb
136
+ - lib/customer_receipts.rb
135
137
  - lib/customers.rb
136
138
  - lib/default_tax_code.rb
137
139
  - lib/query_builder.rb