QNE 0.1.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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +13 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/Gemfile +13 -0
  7. data/Gemfile.lock +95 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +411 -0
  10. data/Rakefile +12 -0
  11. data/lib/QNE/agent/all.rb +22 -0
  12. data/lib/QNE/customer/all.rb +22 -0
  13. data/lib/QNE/customer/create.rb +21 -0
  14. data/lib/QNE/customer/find.rb +18 -0
  15. data/lib/QNE/customer/find_by.rb +20 -0
  16. data/lib/QNE/customer/show.rb +18 -0
  17. data/lib/QNE/customer/update.rb +21 -0
  18. data/lib/QNE/customer_category/all.rb +22 -0
  19. data/lib/QNE/sales_invoice/all.rb +22 -0
  20. data/lib/QNE/sales_invoice/create.rb +21 -0
  21. data/lib/QNE/sales_invoice/download.rb +26 -0
  22. data/lib/QNE/sales_invoice/find_by.rb +20 -0
  23. data/lib/QNE/sales_invoice/show.rb +18 -0
  24. data/lib/QNE/sales_invoice/update.rb +21 -0
  25. data/lib/QNE/sales_order/all.rb +22 -0
  26. data/lib/QNE/sales_order/create.rb +21 -0
  27. data/lib/QNE/sales_order/show.rb +18 -0
  28. data/lib/QNE/stock/all.rb +22 -0
  29. data/lib/QNE/stock/find.rb +18 -0
  30. data/lib/QNE/stock/uoms.rb +18 -0
  31. data/lib/QNE/stock_location/all.rb +17 -0
  32. data/lib/QNE/tax_code/all.rb +22 -0
  33. data/lib/QNE/tax_code/input_tax_codes.rb +22 -0
  34. data/lib/QNE/tax_code/output_tax_codes.rb +22 -0
  35. data/lib/QNE/term/all.rb +22 -0
  36. data/lib/QNE/term/show.rb +18 -0
  37. data/lib/QNE/uom/all.rb +22 -0
  38. data/lib/QNE/user/login.rb +21 -0
  39. data/lib/QNE/version.rb +5 -0
  40. data/lib/QNE.rb +13 -0
  41. data/lib/agents.rb +17 -0
  42. data/lib/base.rb +23 -0
  43. data/lib/connection.rb +139 -0
  44. data/lib/customer_categories.rb +17 -0
  45. data/lib/customers.rb +71 -0
  46. data/lib/default_tax_code.rb +15 -0
  47. data/lib/query_builder.rb +65 -0
  48. data/lib/sales_invoices.rb +64 -0
  49. data/lib/sales_orders.rb +35 -0
  50. data/lib/stock_locations.rb +15 -0
  51. data/lib/stocks.rb +45 -0
  52. data/lib/system_version.rb +13 -0
  53. data/lib/tax_codes.rb +35 -0
  54. data/lib/terms.rb +26 -0
  55. data/lib/uoms.rb +17 -0
  56. data/lib/users.rb +19 -0
  57. data/sig/QNE.rbs +4 -0
  58. metadata +151 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4e736ef116778ab163c7298a8a72427ae9a2e58f8c514a0492aded610184f6c1
4
+ data.tar.gz: 1eed37e03d9b6018d4f95778646c03f5e77de0b291693bf94eb7821aab4580c9
5
+ SHA512:
6
+ metadata.gz: b6b1325ebbe6e0d884a2257809ab3aa29396163462a78daa2f5360da0249b31bdaa6be5dc21103037c300f6b548af6b5d84f09dd3084624da62c676036a934dd
7
+ data.tar.gz: c84ef9d444f393f6a762244da354a29d6429669708229a231a04c5cc1cc9aa62074c19adf9eb21eb2ba74c78677f04a668cc395bc68699e087b385e3a07137da
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-06-08
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at denmarkmeralpis@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in QNE.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "rspec", "~> 3.0"
10
+ gem "rubocop", "~> 1.21"
11
+ gem "faraday-retry", '~> 2.3'
12
+ gem "faraday-net_http_persistent", "~> 2.3"
13
+ gem "net-http-persistent", "~> 4.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ QNE (0.2.0)
5
+ faraday-net_http_persistent (~> 2.3)
6
+ faraday-retry (~> 2.3)
7
+ net-http-persistent (~> 4.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.8.6)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
+ ast (2.4.2)
15
+ bigdecimal (3.1.6)
16
+ connection_pool (2.5.3)
17
+ crack (1.0.0)
18
+ bigdecimal
19
+ rexml
20
+ diff-lcs (1.5.1)
21
+ faraday (2.13.1)
22
+ faraday-net_http (>= 2.0, < 3.5)
23
+ json
24
+ logger
25
+ faraday-net_http (3.4.1)
26
+ net-http (>= 0.5.0)
27
+ faraday-net_http_persistent (2.3.1)
28
+ faraday (~> 2.5)
29
+ net-http-persistent (>= 4.0.4, < 5)
30
+ faraday-retry (2.3.2)
31
+ faraday (~> 2.0)
32
+ hashdiff (1.1.0)
33
+ json (2.12.2)
34
+ logger (1.7.0)
35
+ net-http (0.6.0)
36
+ uri
37
+ net-http-persistent (4.0.6)
38
+ connection_pool (~> 2.2, >= 2.2.4)
39
+ parallel (1.24.0)
40
+ parser (3.3.0.5)
41
+ ast (~> 2.4.1)
42
+ racc
43
+ public_suffix (4.0.7)
44
+ racc (1.7.3)
45
+ rainbow (3.1.1)
46
+ rake (13.1.0)
47
+ regexp_parser (2.9.0)
48
+ rexml (3.2.6)
49
+ rspec (3.13.0)
50
+ rspec-core (~> 3.13.0)
51
+ rspec-expectations (~> 3.13.0)
52
+ rspec-mocks (~> 3.13.0)
53
+ rspec-core (3.13.0)
54
+ rspec-support (~> 3.13.0)
55
+ rspec-expectations (3.13.0)
56
+ diff-lcs (>= 1.2.0, < 2.0)
57
+ rspec-support (~> 3.13.0)
58
+ rspec-mocks (3.13.0)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.13.0)
61
+ rspec-support (3.13.0)
62
+ rubocop (1.28.2)
63
+ parallel (~> 1.10)
64
+ parser (>= 3.1.0.0)
65
+ rainbow (>= 2.2.2, < 4.0)
66
+ regexp_parser (>= 1.8, < 3.0)
67
+ rexml
68
+ rubocop-ast (>= 1.17.0, < 2.0)
69
+ ruby-progressbar (~> 1.7)
70
+ unicode-display_width (>= 1.4.0, < 3.0)
71
+ rubocop-ast (1.17.0)
72
+ parser (>= 3.1.1.0)
73
+ ruby-progressbar (1.13.0)
74
+ unicode-display_width (2.5.0)
75
+ uri (1.0.3)
76
+ webmock (3.20.0)
77
+ addressable (>= 2.8.0)
78
+ crack (>= 0.3.2)
79
+ hashdiff (>= 0.4.0, < 2.0.0)
80
+
81
+ PLATFORMS
82
+ ruby
83
+
84
+ DEPENDENCIES
85
+ QNE!
86
+ faraday-net_http_persistent (~> 2.3)
87
+ faraday-retry (~> 2.3)
88
+ net-http-persistent (~> 4.0)
89
+ rake (~> 13.0)
90
+ rspec (~> 3.0)
91
+ rubocop (~> 1.21)
92
+ webmock (~> 3.4)
93
+
94
+ BUNDLED WITH
95
+ 2.6.9
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Nujian Den Mark Meralpis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,411 @@
1
+ # QNE
2
+
3
+ A ruby wrapper for QNE APIs.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'QNE'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install QNE
20
+
21
+ ## Usage
22
+
23
+ Authorize your request by initializing your `db_code`:
24
+
25
+ ```ruby
26
+ conn = QNE::Connection.new(db_code: 'YouDbCodeHere')
27
+ ```
28
+
29
+ then you can use it to perform desired operation
30
+
31
+ ```ruby
32
+ conn.customers.all(top: 10) # returns top 10 customers
33
+
34
+ # if you want to have a custom retry_block
35
+ # the retry block will be executed before retry happens
36
+ # for example i have a block for creating logs
37
+ def create_logs
38
+ puts 'Error Occurred'.
39
+ end
40
+
41
+ def retry_block
42
+ proc { create_logs }
43
+ end
44
+
45
+ # so now when you establish the connection you will
46
+ # pass the block in the qne_connection argument
47
+ # # when farday occur and it reached the first retry
48
+ # the block will be executed
49
+ conn = @integration.qne_connection(retry_block)
50
+ ```
51
+
52
+ you can also check if the `db_code` is valid:
53
+
54
+ ```ruby
55
+ conn.authenticated?
56
+ ```
57
+
58
+ 1. [Filters](#filters)
59
+ 2. List of available APIs:
60
+ - [Customers](#Customers)
61
+ - [Customer Categories](#Customer-Cetegories)
62
+ - [Default Tax Code](#Default-Tax-Code)
63
+ - [Sales Invoices](#Sales-Invoice)
64
+ - [Sales Orders](#Sales-Orders)
65
+ - [Stocks](#stocks)
66
+ - [Stock Locations](#stock-location)
67
+ - [Terms](#terms)
68
+
69
+ ### Filters
70
+
71
+ You can filter the dataset by using `.where` method.
72
+
73
+ | Name | Description |
74
+ | ---- | --------------------- |
75
+ | `eq` | equal |
76
+ | `ne` | not equal |
77
+ | `gt` | greater than |
78
+ | `lt` | less than |
79
+ | `ge` | greater than or equal |
80
+ | `le` | less than or equal |
81
+
82
+ Example:
83
+
84
+ ```ruby
85
+ conn.sales_orders.where(status: { eq: 'ACTIVE' })
86
+ ```
87
+
88
+ You may also use other api queries such as:
89
+
90
+ | Name | Description |
91
+ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
92
+ | `top` | Returns the top `X` results of the query. |
93
+ | `skip` | Skips `X` results of the query. |
94
+ | `orderby` | Allows you to define the ordering of the returned dataset. |
95
+ | `select` | Allows you to define a subset of properties to return from that Resource. Performance wise, you should define the properties set explicitly. |
96
+
97
+ ##### Example:
98
+
99
+ ```ruby
100
+ conn.customers.where(id: { ne: 1 }).all(top: 10, skip: 0)
101
+ ```
102
+
103
+ ### Customers
104
+
105
+ **1. Fetch all customers**
106
+
107
+ ```ruby
108
+ conn.customers.all
109
+ ```
110
+
111
+ **2. Get a customer by attribute(s):**
112
+
113
+ ```ruby
114
+ conn.customers.find_by(phoneNo1: '09123456789', status: 'ACTIVE')
115
+ ```
116
+
117
+ **3. Create a customer:**
118
+
119
+ ```ruby
120
+ # hash
121
+ customer_hash = {
122
+ companyName: "DEN - (ABELLA NAGA CITY)",
123
+ companyName2: "DEN IBARRA",
124
+ controlAccount: "xxx-xxx-xxx",
125
+ category: "CATEGORY A",
126
+ address1: "AL3 ABELLA NAGA CITY CAMARINES SUR",
127
+ address2: "ABELLA",
128
+ address3: "NAGA CITY/CAMARINES SUR",
129
+ contactPerson: "DEN IBARRA",
130
+ email: "",
131
+ phoneNo1: "09123456789",
132
+ businessNature: "Something",
133
+ area: "NAGA CITY",
134
+ defaultTaxCode: "Something",
135
+ status: "ACTIVE"
136
+ }
137
+
138
+ # creates customer
139
+ conn.customers.create(customer_hash)
140
+ ```
141
+
142
+ **4. View specific customer**
143
+
144
+ ```ruby
145
+ conn.customers.show('id-of-the-customer')
146
+ ```
147
+
148
+ you can also do:
149
+
150
+ ```ruby
151
+ customer = conn.customers.find('id-of-the customer')
152
+ customer.show
153
+ ```
154
+
155
+ **5. Update customer details**
156
+
157
+ ```ruby
158
+ customer_hash = {
159
+ id: "2e2041e9-e963-4ae6-86a5-b9e3c5b808ce",
160
+ companyCode: "xxxx-xxxxx",
161
+ companyName: "DEN - (ABELLA NAGA CITY)",
162
+ companyName2: "DEN IBARRA"
163
+ }
164
+
165
+ conn.customers.update(customer_hash)
166
+ ```
167
+
168
+ ### Customer Categories
169
+
170
+ **1. Fetch all customer categories**
171
+
172
+ ```ruby
173
+ conn.customer_categories.all
174
+ ```
175
+
176
+ ### Default Tax Code
177
+
178
+ ```ruby
179
+ conn.default_tax_code
180
+ ```
181
+
182
+ ### Sales Invoices
183
+
184
+ **1. Fetch all sales invoices**
185
+
186
+ ```ruby
187
+ conn.sales_invoices.all
188
+ ```
189
+
190
+ **2. View a specific sales invoice:**
191
+
192
+ ```ruby
193
+ conn.sales_invoices.show('xxx-xxx-xxx')
194
+ ```
195
+
196
+ **3. Create a sales invoice:**
197
+
198
+ ```ruby
199
+ sales_invoice_hash = {
200
+ address1: "Zone 2, San Antonio, MILAOR, CAMARINES SUR",
201
+ address2: "San Antonio/MILAOR",
202
+ address3: "CAMARINES SUR",
203
+ attention: "John Doe",
204
+ customer: "xxxxxxxxxx",
205
+ details: [
206
+ {
207
+ dateRef1: "2023-06-07T01:19:37.167Z",
208
+ description: "Product X",
209
+ numbering: "1",
210
+ project: "PROJECT A",
211
+ qty: 5,
212
+ stock: "9999",
213
+ stockLocation: "LOCATION_CODE",
214
+ unitPrice: "17.5",
215
+ uom: "piece"
216
+ }
217
+ ],
218
+ doAddress1: "Zone 2, San Antonio, MILAOR, CAMARINES SUR",
219
+ doAddress2: "San Antonio/MILAOR",
220
+ doAddress3: "CAMARINES SUR",
221
+ doContact: "John Doe",
222
+ doPhone: "09999999999",
223
+ invoiceDate: "2023-06-07T01:19:37.167Z",
224
+ invoiceTo: "Doe Store",
225
+ phone: "09999999999",
226
+ project: "PROJECT A",
227
+ referenceNo: "R9999-9-9",
228
+ remark1: "PM1",
229
+ stockLocation: "LOCATION CODE",
230
+ title: "PICKER NAME",
231
+ title2: "CHECKER NAME"
232
+ }
233
+
234
+ conn.sales_invoices.create(sales_invoice_hash)
235
+ ```
236
+
237
+ **4. Update a sales invoice:**
238
+
239
+ ```ruby
240
+ sales_invoice_hash = {
241
+ id: "xxxxxxxxx",
242
+ address1: "Updated address",
243
+ address2: "Updated address2",
244
+ address3: "CAMARINES SUR",
245
+ attention: "John Doe",
246
+ customer: "xxxxxxxxxx",
247
+ details: [
248
+ {
249
+ dateRef1: "2023-06-07T01:19:37.167Z",
250
+ description: "Product X",
251
+ numbering: "1",
252
+ project: "PROJECT A",
253
+ qty: 5,
254
+ stock: "9999",
255
+ stockLocation: "LOCATION_CODE",
256
+ unitPrice: "17.5",
257
+ uom: "piece"
258
+ }
259
+ ],
260
+ doAddress1: "Updated address",
261
+ doAddress2: "San Antonio/MILAOR",
262
+ doAddress3: "CAMARINES SUR",
263
+ doContact: "John Doe",
264
+ doPhone: "09999999999",
265
+ invoiceDate: "2023-06-07T01:19:37.167Z",
266
+ invoiceTo: "Doe Store",
267
+ phone: "09999999999",
268
+ project: "PROJECT A",
269
+ referenceNo: "R9999-9-9",
270
+ remark1: "PM1",
271
+ stockLocation: "LOCATION CODE",
272
+ title: "PICKER NAME",
273
+ title2: "CHECKER NAME"
274
+ }
275
+
276
+ conn.sales_invoices.update(sales_invoice_hash)
277
+ ```
278
+
279
+ **5. Generate sales invoice download link**
280
+
281
+ There are two types of downloadable links:
282
+ 1. `tax_invoice`
283
+ 2. `sales_invoice` (default)
284
+
285
+ ```ruby
286
+ conn.sales_invoices.download('id-of-sales-invoice', 'tax_invoice')
287
+ ```
288
+
289
+ ### Sales Orders
290
+
291
+ **1. Fetch all sales orders**
292
+
293
+ ```ruby
294
+ conn.sales_orders.all
295
+ ```
296
+
297
+ **2. View a specific sales order:**
298
+
299
+ ```ruby
300
+ conn.sales_orders.show('xxx-xxx-xxx')
301
+ ```
302
+
303
+ **3. Create a sales order:**
304
+
305
+ ```ruby
306
+ sales_order_hash = {
307
+ address1: "Zone 9, San Antonio, MILAOR, CAMARINES SUR",
308
+ address2: "San Antonio/MILAOR",
309
+ address3: "CAMARINES SUR",
310
+ attention: "John Doe",
311
+ customer: "customer-id-123",
312
+ customerName: "Doe Store",
313
+ details: [
314
+ {
315
+ description: "Product Name",
316
+ qty: "5",
317
+ stock: "1495992",
318
+ unitPrice: "17.5",
319
+ uom: "piece"
320
+ }
321
+ ],
322
+ doAddress1: "Zone 9, San Antonio, MILAOR, CAMARINES SUR",
323
+ doAddress2: "San Antonio/MILAOR",
324
+ doAddress3: "CAMARINES SUR",
325
+ doContact: "John Doe",
326
+ doPhone: "09999999999",
327
+ isApproved: true,
328
+ isCancelled: false,
329
+ isTaxInclusive: true,
330
+ orderDate: "2023-06-01T01:19:37.167Z",
331
+ phone: "09999999999",
332
+ referenceNo: "R99999-9-9",
333
+ remark1: "",
334
+ project: "PROJECT NAME",
335
+ stockLocation: "STOCK CODE"
336
+ }
337
+
338
+ conn.sales_orders.create(sales_order_hash)
339
+ ```
340
+
341
+ ### Stocks
342
+
343
+ **1. Fetch all stocks**
344
+
345
+ ```ruby
346
+ conn.stocks.all
347
+ ```
348
+
349
+ **2. Fetch all UOMs of a specific stock**
350
+
351
+ ```ruby
352
+ stock = conn.stocks.find('stock-id')
353
+ stock.uoms
354
+ ```
355
+
356
+ or
357
+
358
+ ```ruby
359
+ conn.stocks.find_uoms_by_id('stock-id')
360
+ ```
361
+
362
+ **3. View specific stock**
363
+
364
+ ```ruby
365
+ stock = conn.stocks.find('stock-id')
366
+ stock.show
367
+ ```
368
+
369
+ ### Stock Locations
370
+
371
+ **1. Fetch all stock locations**
372
+
373
+ ```ruby
374
+ conn.stock_locations.all
375
+ ```
376
+
377
+ _Note: `filters` and `queries` won't work for this specific action._
378
+
379
+ ### Terms
380
+
381
+ **1. Fetch all terms**
382
+
383
+ ```ruby
384
+ conn.terms.all
385
+ ```
386
+
387
+ **2. Get a term by attribute(s):**
388
+
389
+ ```ruby
390
+ conn.terms.show('id')
391
+ ```
392
+
393
+
394
+
395
+ ## Development
396
+
397
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
398
+
399
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
400
+
401
+ ## Contributing
402
+
403
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/QNE. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/QNE/blob/main/CODE_OF_CONDUCT.md).
404
+
405
+ ## License
406
+
407
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
408
+
409
+ ## Code of Conduct
410
+
411
+ Everyone interacting in the QNE project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/QNE/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QNE
4
+ module Agent
5
+ class All
6
+ PATH = '/api/Agents'
7
+
8
+ def initialize(conn, params: {})
9
+ @conn = conn
10
+ @params = params
11
+ end
12
+
13
+ def call
14
+ @conn.get(PATH) do |req|
15
+ @params.each do |key, val|
16
+ req.params[key] = val
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end