ruby-brightpearl 0.9.0 → 0.11.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 +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +6 -5
- data/lib/brightpearl/resources/contact_custom_field_metadata.rb +26 -0
- data/lib/brightpearl/resources/customer_payment.rb +47 -0
- data/lib/brightpearl/resources/order_custom_field_metadata.rb +26 -0
- data/lib/brightpearl/resources/product_custom_field_metadata.rb +13 -0
- data/lib/brightpearl/resources.rb +5 -1
- data/lib/brightpearl/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de2c63aae118383c79591261adf50e2c73511d3a3939591288937883892c3a76
|
|
4
|
+
data.tar.gz: f54a265866ae77e46343e6701801aa0c994431955850a31015bcea675b773d3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0be98a97c29dbfe0239ee63fed3b270dcfd688d284e71178e192c5b3527c4d893e8bc9919a4b87de3d56bc086dd410ea50fba481f30d23bcbfc07b8aee9ca7ed
|
|
7
|
+
data.tar.gz: a721a3a87235c91a7520e0db43bbb00d91df3d4de7934bc5cf991e4a81644825cda5bbddca7fb9f24ed341a9ea61fcf82d455f3691b3c6952087ab8b1d4c8b32
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.11.0] - 2026-05-08
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- New resources `ContactCustomFieldMetadata`, `OrderCustomFieldMetadata`, and `ProductCustomFieldMetadata`
|
|
8
|
+
- Available operations: `GET`
|
|
9
|
+
- Useful to get the available custom fields for a contact, order, or product and their metadata (name, type, list of values, etc.)
|
|
10
|
+
|
|
11
|
+
## [0.10.0] - 2026-04-17
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- New resource `CustomerPayment`
|
|
16
|
+
- Available operations: `SEARCH`, `POST`, `DELETE`
|
|
17
|
+
|
|
3
18
|
## [0.9.0] - 2025-12-10
|
|
4
19
|
|
|
5
20
|
### Changed
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ruby-brightpearl (0.
|
|
4
|
+
ruby-brightpearl (0.11.0)
|
|
5
5
|
httparty (~> 0.20)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -10,7 +10,7 @@ GEM
|
|
|
10
10
|
addressable (2.8.0)
|
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
|
12
12
|
base64 (0.3.0)
|
|
13
|
-
bigdecimal (
|
|
13
|
+
bigdecimal (4.1.2)
|
|
14
14
|
byebug (11.1.3)
|
|
15
15
|
coderay (1.1.3)
|
|
16
16
|
crack (0.4.5)
|
|
@@ -19,14 +19,14 @@ GEM
|
|
|
19
19
|
diff-lcs (1.5.0)
|
|
20
20
|
dotenv (3.1.8)
|
|
21
21
|
hashdiff (1.0.1)
|
|
22
|
-
httparty (0.
|
|
22
|
+
httparty (0.24.2)
|
|
23
23
|
csv
|
|
24
24
|
mini_mime (>= 1.0.0)
|
|
25
25
|
multi_xml (>= 0.5.2)
|
|
26
26
|
method_source (1.1.0)
|
|
27
27
|
mini_mime (1.1.5)
|
|
28
|
-
multi_xml (0.
|
|
29
|
-
bigdecimal (
|
|
28
|
+
multi_xml (0.9.1)
|
|
29
|
+
bigdecimal (>= 3.1, < 5)
|
|
30
30
|
pry (0.15.2)
|
|
31
31
|
coderay (~> 1.1)
|
|
32
32
|
method_source (~> 1.0)
|
|
@@ -54,6 +54,7 @@ GEM
|
|
|
54
54
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
55
55
|
|
|
56
56
|
PLATFORMS
|
|
57
|
+
arm64-darwin-25
|
|
57
58
|
x86_64-linux
|
|
58
59
|
|
|
59
60
|
DEPENDENCIES
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Brightpearl
|
|
2
|
+
# https://api-docs.brightpearl.com/contact/custom-field-meta-data/get.html
|
|
3
|
+
class ContactCustomFieldMetadata < Resource
|
|
4
|
+
VALID_CONTACT_TYPES = ["customer", "supplier"].freeze
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
def get(contact_type, id_set = nil)
|
|
8
|
+
contact_type = contact_type.to_s
|
|
9
|
+
validate_contact_type!(contact_type)
|
|
10
|
+
|
|
11
|
+
path = "contact-service/#{contact_type}/custom-field-meta-data"
|
|
12
|
+
path = "#{path}/#{id_set}" if id_set
|
|
13
|
+
|
|
14
|
+
send_request(path: path, method: :get)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def validate_contact_type!(contact_type)
|
|
20
|
+
return if VALID_CONTACT_TYPES.include?(contact_type)
|
|
21
|
+
|
|
22
|
+
raise ArgumentError, "Invalid contact custom field metadata type: #{contact_type.inspect}. Valid types: #{VALID_CONTACT_TYPES.join(', ')}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Brightpearl
|
|
2
|
+
# https://api-docs.brightpearl.com/accounting/customer-payment/index.html
|
|
3
|
+
class CustomerPayment < Resource
|
|
4
|
+
extend Brightpearl::APIOperations::Post
|
|
5
|
+
extend Brightpearl::APIOperations::Delete
|
|
6
|
+
|
|
7
|
+
attr_accessor :payment_id, :transaction_ref, :transaction_code, :payment_method_code,
|
|
8
|
+
:payment_type, :order_id, :currency_id, :currency_code,
|
|
9
|
+
:amount_authorized, :amount_paid, :expires, :payment_date,
|
|
10
|
+
:created_on, :journal_id
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def resource_path
|
|
14
|
+
"accounting-service/customer-payment"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# https://api-docs.brightpearl.com/accounting/customer-payment/post.html
|
|
18
|
+
# https://api-docs.brightpearl.com/accounting/customer-payment/delete.html
|
|
19
|
+
|
|
20
|
+
# https://api-docs.brightpearl.com/accounting/customer-payment/search.html
|
|
21
|
+
def search(query_params = {})
|
|
22
|
+
response = send_request(path: "accounting-service/customer-payment-search?#{to_query(query_params)}", method: :get)
|
|
23
|
+
return response.merge({
|
|
24
|
+
records: response[:payload]["response"]["results"].map { |item| CustomerPayment.new(item) },
|
|
25
|
+
})
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# ARA => API Record Array
|
|
30
|
+
def initialize(ara)
|
|
31
|
+
@payment_id = ara[0]
|
|
32
|
+
@transaction_ref = ara[1]
|
|
33
|
+
@transaction_code = ara[2]
|
|
34
|
+
@payment_method_code = ara[3]
|
|
35
|
+
@payment_type = ara[4]
|
|
36
|
+
@order_id = ara[5]
|
|
37
|
+
@currency_id = ara[6]
|
|
38
|
+
@currency_code = ara[7]
|
|
39
|
+
@amount_authorized = ara[8]
|
|
40
|
+
@amount_paid = ara[9]
|
|
41
|
+
@expires = ara[10]
|
|
42
|
+
@payment_date = ara[11]
|
|
43
|
+
@created_on = ara[12]
|
|
44
|
+
@journal_id = ara[13]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Brightpearl
|
|
2
|
+
# https://api-docs.brightpearl.com/order/customfield-metadata/get.html
|
|
3
|
+
class OrderCustomFieldMetadata < Resource
|
|
4
|
+
VALID_ORDER_TYPES = ["sale", "purchase"].freeze
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
def get(order_type, id_set = nil)
|
|
8
|
+
order_type = order_type.to_s
|
|
9
|
+
validate_order_type!(order_type)
|
|
10
|
+
|
|
11
|
+
path = "order-service/#{order_type}/custom-field-meta-data"
|
|
12
|
+
path = "#{path}/#{id_set}" if id_set
|
|
13
|
+
|
|
14
|
+
send_request(path: path, method: :get)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def validate_order_type!(order_type)
|
|
20
|
+
return if VALID_ORDER_TYPES.include?(order_type)
|
|
21
|
+
|
|
22
|
+
raise ArgumentError, "Invalid order custom field metadata type: #{order_type.inspect}. Valid types: #{VALID_ORDER_TYPES.join(', ')}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Brightpearl
|
|
2
|
+
# https://api-docs.brightpearl.com/product/product-custom-field-metadata/get.html
|
|
3
|
+
class ProductCustomFieldMetadata < Resource
|
|
4
|
+
class << self
|
|
5
|
+
def get(id_set = nil)
|
|
6
|
+
path = "product-service/product/custom-field-meta-data"
|
|
7
|
+
path = "#{path}/#{id_set}" if id_set
|
|
8
|
+
|
|
9
|
+
send_request(path: path, method: :get)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -2,6 +2,7 @@ require 'brightpearl/resource'
|
|
|
2
2
|
|
|
3
3
|
require 'brightpearl/resources/contact'
|
|
4
4
|
require 'brightpearl/resources/contact_custom_field'
|
|
5
|
+
require 'brightpearl/resources/contact_custom_field_metadata'
|
|
5
6
|
|
|
6
7
|
require 'brightpearl/resources/order'
|
|
7
8
|
require 'brightpearl/resources/order_row'
|
|
@@ -9,6 +10,7 @@ require 'brightpearl/resources/order_shipping_status'
|
|
|
9
10
|
require 'brightpearl/resources/order_status'
|
|
10
11
|
require 'brightpearl/resources/order_status_update'
|
|
11
12
|
require 'brightpearl/resources/order_custom_field'
|
|
13
|
+
require 'brightpearl/resources/order_custom_field_metadata'
|
|
12
14
|
|
|
13
15
|
require 'brightpearl/resources/goods_out_note'
|
|
14
16
|
|
|
@@ -16,9 +18,11 @@ require 'brightpearl/resources/product'
|
|
|
16
18
|
require 'brightpearl/resources/product_price'
|
|
17
19
|
require 'brightpearl/resources/price_list'
|
|
18
20
|
require 'brightpearl/resources/product_availability'
|
|
21
|
+
require 'brightpearl/resources/product_custom_field_metadata'
|
|
19
22
|
|
|
20
23
|
# Integration
|
|
21
24
|
require 'brightpearl/resources/webhook'
|
|
22
25
|
|
|
23
26
|
# Accounting
|
|
24
|
-
require 'brightpearl/resources/tax_code'
|
|
27
|
+
require 'brightpearl/resources/tax_code'
|
|
28
|
+
require 'brightpearl/resources/customer_payment'
|
data/lib/brightpearl/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-brightpearl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vicvans20
|
|
@@ -154,9 +154,12 @@ files:
|
|
|
154
154
|
- lib/brightpearl/resources.rb
|
|
155
155
|
- lib/brightpearl/resources/contact.rb
|
|
156
156
|
- lib/brightpearl/resources/contact_custom_field.rb
|
|
157
|
+
- lib/brightpearl/resources/contact_custom_field_metadata.rb
|
|
158
|
+
- lib/brightpearl/resources/customer_payment.rb
|
|
157
159
|
- lib/brightpearl/resources/goods_out_note.rb
|
|
158
160
|
- lib/brightpearl/resources/order.rb
|
|
159
161
|
- lib/brightpearl/resources/order_custom_field.rb
|
|
162
|
+
- lib/brightpearl/resources/order_custom_field_metadata.rb
|
|
160
163
|
- lib/brightpearl/resources/order_row.rb
|
|
161
164
|
- lib/brightpearl/resources/order_shipping_status.rb
|
|
162
165
|
- lib/brightpearl/resources/order_status.rb
|
|
@@ -164,6 +167,7 @@ files:
|
|
|
164
167
|
- lib/brightpearl/resources/price_list.rb
|
|
165
168
|
- lib/brightpearl/resources/product.rb
|
|
166
169
|
- lib/brightpearl/resources/product_availability.rb
|
|
170
|
+
- lib/brightpearl/resources/product_custom_field_metadata.rb
|
|
167
171
|
- lib/brightpearl/resources/product_price.rb
|
|
168
172
|
- lib/brightpearl/resources/tax_code.rb
|
|
169
173
|
- lib/brightpearl/resources/webhook.rb
|