bukku_rails 0.2.1 → 0.3.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: c67f4ffcd9e8bb2bba1d68c241003ba09ade70e0e7b5006a01373d047b4cf5e9
4
- data.tar.gz: aa4ae29f71918a76fcdab8ac286752dd5b8f4ad9ae79fb4089b2da95c5f5e4bf
3
+ metadata.gz: 565be27afe248599db5d33a723aaa9a5ad9c57bc25ffab1b7f8e0f9a91fb5bf5
4
+ data.tar.gz: cccbcfb3e2dbdef04b6d851f9504b31f93e5c897e2a198a680a9a2f863e671c6
5
5
  SHA512:
6
- metadata.gz: cacbd80c9079264a39ac0426777de2d9110e974599768585685066f6cc04e2acec4fb371562b49759d6ff91385d91f3f05132b96c2b3580139aa69782dc1a868
7
- data.tar.gz: 034b19b90d92d54f5f6361b8ba977b39a4c00d5a727fcb970e2cab6191fda237f87d9d29513bea1f51a5d976d053c676a21721643429a820b7e646af0064c922
6
+ metadata.gz: 01d76b79443c4113cfe1bc605cffea51bf241b9d69f6a98c1b10185939164d8aa75ca39d68ab5ea53d84f63d007883109993fa4188b99a7dff7d9e08424f709f
7
+ data.tar.gz: 0b017d34db3dbe0cfef610aadcf14e2e1dc7987b73aecb1ac179463000569b69fa1a3495f6663a6c68c945ade9242a6972741ee75eaaa37d04cc470d0eed5fe5
data/README.md CHANGED
@@ -4,7 +4,7 @@ Use Rails methods to interact with your data in [Bukku](https://bukku.my/) accou
4
4
 
5
5
  Take a look at [Bukku's API](https://developers.bukku.my) to know what data you can extract from Bukku.
6
6
 
7
- > As of December 2, 2025, the gem only handles **GET** request. If you require other request, fork the gem and write it and then send us a Pull Request.
7
+ > As of February 2026, the gem handles **GET**, **POST**, and **file upload** requests.
8
8
 
9
9
  ## Installation
10
10
 
@@ -36,13 +36,15 @@ Note: Bukku offers 2 type of access:
36
36
 
37
37
  **Bukku Rails** provides usage for both access, under 2 different classes:
38
38
 
39
- 1. *Staging* use the `BukkuTest` class, like so `client = BukkuTest.new(domain: "sub-domain", token: "token-from-bukku-fyi")`
39
+ 1. *Staging* use the `BukkuTest` class, like so
40
+ `client = BukkuTest.new(domain: "sub-domain", token: "api-token-from-bukku-fyi")`
40
41
 
41
- 2. *Production* use `Bukku` class, like so `client = Bukku.new(domain: "sub-domain", token: "token-from-bukku-my")`
42
+ 2. *Production* use `Bukku` class, like so
43
+ `client = Bukku.new(domain: "sub-domain", token: "api-token-from-bukku-my")`
42
44
 
43
45
  ### Available Methods
44
46
 
45
- Just like in Rails the methods follow the singular and plural expression. Methods with arguments are normally plural, while methods without arguments are singular methods calls.
47
+ Just like in Rails the methods follow the singular and plural expression. Methods that might return multiple records are plural expression methods. While methods that returns or create a single records are singular methods. So be careful where you put your ***s***'s 😁
46
48
 
47
49
  #### Sales
48
50
 
@@ -50,18 +52,25 @@ Just like in Rails the methods follow the singular and plural expression. Method
50
52
  |------------|-------------|----------|
51
53
  | GET | `get_sales_quotes(query-parameters)` | `/sales/quotes` |
52
54
  | GET | `get_sales_quote(id)` | `/sales/quotes/:id` |
55
+ | POST | `create_quote(body:)` | `/sales/quotes` |
53
56
  | GET | `get_sales_orders(query-parameters)` | `/sales/orders` |
54
57
  | GET | `get_sales_order(id)` | `/sales/orders/:id` |
58
+ | POST | `create_sales_order(body:)` | `/sales/orders` |
55
59
  | GET | `get_delivery_orders(query-parameters)` | `/sales/delivery_orders` |
56
60
  | GET | `get_delivery_order(id)` | `/sales/delivery_orders/:id` |
61
+ | POST | `create_delivery_order(body:)` | `/sales/delivery_orders` |
57
62
  | GET | `get_invoices(query-parameters)` | `/sales/invoices` |
58
63
  | GET | `get_invoice(id)` | `/sales/invoices/:id` |
64
+ | POST | `create_invoice(body:)` | `/sales/invoices` |
59
65
  | GET | `get_sales_credit_notes(query-parameters)` | `/sales/credit_notes` |
60
66
  | GET | `get_sales_credit_note(id)` | `/sales/credit_notes/:id` |
67
+ | POST | `create_credit_note(body:)` | `/sales/credit_notes` |
61
68
  | GET | `get_sales_payments(query-parameters)` | `/sales/payments` |
62
69
  | GET | `get_sales_payment(id)` | `/sales/payments/:id` |
70
+ | POST | `create_payment(body:)` | `/sales/payments` |
63
71
  | GET | `get_sales_refunds(query-parameters)` | `/sales/refunds` |
64
72
  | GET | `get_sales_refund(id)` | `/sales/refunds/:id` |
73
+ | POST | `create_refund(body:)` | `/sales/refunds` |
65
74
 
66
75
  #### Purchases
67
76
 
@@ -69,16 +78,22 @@ Just like in Rails the methods follow the singular and plural expression. Method
69
78
  |------------|-------------|----------|
70
79
  | GET | `get_purchase_orders(query-parameters)` | `/purchases/orders` |
71
80
  | GET | `get_purchase_order(id)` | `/purchases/orders/:id` |
81
+ | POST | `create_purchase_order(body:)` | `/purchases/orders` |
72
82
  | GET | `get_received_notes(query-parameters)` | `/purchases/goods_received_notes` |
73
83
  | GET | `get_received_note(id)` | `/purchases/goods_received_notes/:id` |
84
+ | POST | `create_received_note(body:)` | `/purchases/goods_received_notes` |
74
85
  | GET | `get_bills(query-parameters)` | `/purchases/bills` |
75
86
  | GET | `get_bill(id)` | `/purchases/bills/:id` |
87
+ | POST | `create_bill(body:)` | `/purchases/bills` |
76
88
  | GET | `get_purchases_credit_notes(query-parameters)` | `/purchases/credit_notes` |
77
89
  | GET | `get_purchases_credit_note(id)` | `/purchases/credit_notes/:id` |
90
+ | POST | `create_purchase_credit_note(body:)` | `/purchases/credit_note` |
78
91
  | GET | `get_purchases_payments(query-parameters)` | `/purchases/payments` |
79
- | GET | `get_purchases_payments(id)` | `/purchases/payments/:id` |
92
+ | GET | `get_purchases_payment(id)` | `/purchases/payments/:id` |
93
+ | POST | `create_purchases_payment(body:)` | `/purchases/payments` |
80
94
  | GET | `get_purchases_refunds(query-parameters)` | `/purchases/refunds` |
81
95
  | GET | `get_purchases_refund(id)` | `/purchases/refunds/:id` |
96
+ | POST | `create_purchases_refund(body:)` | `/purchases/refunds` |
82
97
 
83
98
  #### Banking
84
99
 
@@ -86,10 +101,13 @@ Just like in Rails the methods follow the singular and plural expression. Method
86
101
  |------------|-------------|----------|
87
102
  | GET | `get_banking_incomes(query-parameters)` | `/banking/incomes` |
88
103
  | GET | `get_banking_income(id)` | `/banking/incomes/:id` |
104
+ | POST | `create_banking_income(body:)` | `/banking/incomes` |
89
105
  | GET | `get_banking_expenses(query-parameters)` | `/banking/expenses` |
90
106
  | GET | `get_banking_expense(id)` | `/banking/expenses/:id` |
107
+ | POST | `create_expense(body:)` | `/banking/expenses` |
91
108
  | GET | `get_transfers(query-parameters)` | `/banking/transfers` |
92
109
  | GET | `get_transfer(id)` | `/banking/transfers/:id` |
110
+ | POST | `create_transfer(body:)` | `/banking/transfer` |
93
111
 
94
112
  #### Contacts
95
113
 
@@ -97,8 +115,10 @@ Just like in Rails the methods follow the singular and plural expression. Method
97
115
  |------------|-------------|----------|
98
116
  | GET | `get_contacts(query-parameters)` | `/contacts` |
99
117
  | GET | `get_contact(id)` | `/contacts/:id` |
118
+ | POST | `create_contact(body:)` | `/contacts` |
100
119
  | GET | `get_contact_groups(query-parameters)` | `/contacts/groups` |
101
120
  | GET | `get_contact_group(id)` | `/contacts/groups/:id` |
121
+ | POST | `create_group(body:)` | `/contacts/groups` |
102
122
 
103
123
  #### Products
104
124
 
@@ -106,8 +126,12 @@ Just like in Rails the methods follow the singular and plural expression. Method
106
126
  |------------|-------------|----------|
107
127
  | GET | `get_products(query-parameters)` | `/products` |
108
128
  | GET | `get_product(id)` | `/products/:id` |
129
+ | POST | `create_product(body:)` | `/products` |
130
+ | GET | `get_bundle(id)` | `/products/bundles/:id` |
131
+ | POST | `create_bundle(body:)` | `/products/bundles` |
109
132
  | GET | `get_product_groups(query-parameters)` | `/products/groups` |
110
133
  | GET | `get_product_group(id)` | `/products/groups/:id` |
134
+ | POST | `create_product_group(body:)` | `/products/groups` |
111
135
 
112
136
  #### Accounting
113
137
 
@@ -115,8 +139,16 @@ Just like in Rails the methods follow the singular and plural expression. Method
115
139
  |------------|-------------|----------|
116
140
  | GET | `get_journal_entries(query-parameters)` | `/journal_entries` |
117
141
  | GET | `get_journal_entry(id)` | `/journal_entries/:id` |
142
+ | POST | `create_journal_entry(body:)` | `/journal_entries` |
118
143
  | GET | `get_accounts(query-parameters)` | `/accounts` |
119
144
  | GET | `get_account(id)` | `/accounts/:id` |
145
+ | POST | `create_account(body:)` | `/accounts` |
146
+
147
+ #### Files
148
+
149
+ | HTTP Method | Ruby Method | Endpoint |
150
+ |------------|-------------|----------|
151
+ | POST | `upload_file(file_data:, filename:, mime_type:)` | `/files` |
120
152
 
121
153
  ### Examples
122
154
 
@@ -159,10 +191,34 @@ invoices = client.get_invoices(date_from: "2025-11-01", date_to: "2025-11-30")
159
191
  invoice = client.get_invoice(123)
160
192
  ```
161
193
 
194
+ **Creating a new contact (or supplier)**:
195
+
196
+ ```ruby
197
+ body = {
198
+ entity_type: "MALAYSIAN_COMPANY",
199
+ legal_name: invoice.supplier_name,
200
+ types: ["supplier"]
201
+ }
202
+
203
+ contact = client.create_contact(body: body)
204
+ ```
205
+
206
+ **File upload:**
207
+
208
+ ```ruby
209
+
210
+ file_data = File.read("invoice.pdf")
211
+ filename = "invoice.pdf"
212
+ mime_type = "application/pdf"
213
+
214
+ client.upload_file(file_data: file_data, filename: filename, mime_type: mime_type)
215
+
216
+ ```
217
+
162
218
  ## Contributing
163
219
 
164
220
  Bug reports and pull requests are welcome on GitHub at <https://github.com/stopar/bukku_rails>.
165
221
 
166
222
  ## License
167
223
 
168
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
224
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BukkuRails
4
- VERSION = '0.2.1'
4
+ VERSION = '0.3.0'
5
5
  end
data/lib/bukku_test.rb CHANGED
@@ -4,7 +4,7 @@ class BukkuTest < Client
4
4
  # respond = access.<method>
5
5
 
6
6
  # Testing URL
7
- BASE_URI = 'https://api.bukku.fyi'
7
+ BASE_URI = 'https://api.staging.bukku.dev'
8
8
 
9
9
  ## SALES
10
10
  # Quotation
data/lib/client.rb CHANGED
@@ -49,7 +49,7 @@ class Client
49
49
  http.use_ssl = uri.instance_of?(URI::HTTPS)
50
50
 
51
51
  # Add the 2 lines below because development keeps on failing SSL CRL checks
52
- # Check this article for explanation:
52
+ # Check this article for explanation:
53
53
  # https://dev.to/madhuhari188/how-we-solved-unable-to-get-certificate-crl-in-rails-a-debugging-story-2pna
54
54
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
55
55
  http.verify_callback = ->(_preverify_ok, _store_ctx) { true }
@@ -58,7 +58,7 @@ class Client
58
58
  end
59
59
 
60
60
  def make_request(klass, path, query: {}, body: {})
61
- # Uncomment below for debuging purpose to see the payload that was sent.
61
+ # Uncomment below for debuging purpose to see payload that was sent.
62
62
  # build_http(uri).set_debug_output($stdout)
63
63
 
64
64
  uri = URI("#{base_uri}#{path}")
@@ -90,5 +90,6 @@ class Client
90
90
  raise Error, "#{response.code}: #{response.body}"
91
91
  end
92
92
  end
93
+
93
94
  class Error < StandardError; end
94
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bukku_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muzaffar Ariff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-26 00:00:00.000000000 Z
11
+ date: 2026-05-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Use Rails conventions to call Bukku API requests.
14
14
  email: