ruby-brightpearl 0.6.0 → 0.8.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 +22 -2
- data/Gemfile.lock +3 -3
- data/lib/brightpearl/api_operations/delete.rb +9 -0
- data/lib/brightpearl/api_operations.rb +2 -1
- data/lib/brightpearl/client.rb +1 -0
- data/lib/brightpearl/errors.rb +4 -2
- data/lib/brightpearl/resources/goods_out_note.rb +52 -0
- data/lib/brightpearl/resources/webhook.rb +19 -0
- data/lib/brightpearl/resources.rb +6 -0
- data/lib/brightpearl/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 499b1eb7f7e7ce054f49f19ba9dfd25602c3135b200c3d15c6934ec37379aca6
|
|
4
|
+
data.tar.gz: 62a70dfaff891786c97f0524825be9475fed68e2b6ca57a826349a4afea4fdd5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98df0eadf345303d0163af51e20b55b401cfab34fe2585c016fada116c12fa4bad89ba0e2828498e5954ffce9427311855396ab2a7f738fa1b6a7aab962aaf86
|
|
7
|
+
data.tar.gz: 3c5c601b90a6b20d2827965f2879377195d994fc393ccb60fdc8e67caa6b555e7b00b67c70ea67a3c2725e84d9413641b44e07ae090973d666d14ea63e9ed0fb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
-
## [0.
|
|
3
|
+
## [0.8.0] - 2025-11-05
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **New resource `GoodsOutNote`**
|
|
8
|
+
- Available operations: `GET`, `POST`, `PUT`, `DELETE`
|
|
9
|
+
- Search is still pending to be implemented
|
|
10
|
+
|
|
11
|
+
## [0.7.0] - 2025-11-03
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- New API Operation `DELETE`
|
|
16
|
+
- **New resource `Webhook`**
|
|
17
|
+
- Available operations: `GET`, `POST`, `DELETE`
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Improved `Brightpearl::RequestError` message to include error code when available
|
|
21
|
+
- For example, `CMNC-404 - Resource not found` instead of just `Resource not found`
|
|
22
|
+
|
|
23
|
+
## [0.6.0] - 2025-08-28
|
|
4
24
|
|
|
5
25
|
- New resource `Customer`
|
|
6
26
|
- New resource `CustomerCustomField`
|
|
7
27
|
- Minor fixes on development libs
|
|
8
28
|
|
|
9
|
-
## [0.5.0]
|
|
29
|
+
## [0.5.0] - 2025-03-27
|
|
10
30
|
|
|
11
31
|
- Add new resource OrderCustomField
|
|
12
32
|
- Improve test environment to use different bp credentials without breaking the cassettes
|
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.8.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 (3.
|
|
13
|
+
bigdecimal (3.3.1)
|
|
14
14
|
byebug (11.1.3)
|
|
15
15
|
coderay (1.1.3)
|
|
16
16
|
crack (0.4.5)
|
|
@@ -19,7 +19,7 @@ GEM
|
|
|
19
19
|
diff-lcs (1.5.0)
|
|
20
20
|
dotenv (3.1.8)
|
|
21
21
|
hashdiff (1.0.1)
|
|
22
|
-
httparty (0.23.
|
|
22
|
+
httparty (0.23.2)
|
|
23
23
|
csv
|
|
24
24
|
mini_mime (>= 1.0.0)
|
|
25
25
|
multi_xml (>= 0.5.2)
|
|
@@ -2,4 +2,5 @@ require 'brightpearl/api_operations/get'
|
|
|
2
2
|
require 'brightpearl/api_operations/post'
|
|
3
3
|
require 'brightpearl/api_operations/patch'
|
|
4
4
|
require 'brightpearl/api_operations/put'
|
|
5
|
-
require 'brightpearl/api_operations/options'
|
|
5
|
+
require 'brightpearl/api_operations/options'
|
|
6
|
+
require 'brightpearl/api_operations/delete'
|
data/lib/brightpearl/client.rb
CHANGED
|
@@ -54,6 +54,7 @@ module Brightpearl
|
|
|
54
54
|
elsif response.code == 401
|
|
55
55
|
raise Brightpearl::InvalidToken.new(json["response"], response: json, status: 401)
|
|
56
56
|
elsif !!json["errors"]
|
|
57
|
+
# Request Error is the fallback message. If response has a tangible error message, first one will be used from response json
|
|
57
58
|
raise Brightpearl::RequestError.new("Request Error", response: json, status: response.code)
|
|
58
59
|
end
|
|
59
60
|
|
data/lib/brightpearl/errors.rb
CHANGED
|
@@ -3,9 +3,11 @@ module Brightpearl
|
|
|
3
3
|
attr_reader :response, :code, :status
|
|
4
4
|
def initialize(msg, response: nil, status: nil)
|
|
5
5
|
if response["errors"] && response["errors"].size == 1 # If error is easily identifiable then set it as the Error message
|
|
6
|
-
|
|
6
|
+
error_message = response["errors"][0]["message"]
|
|
7
7
|
@code = response["errors"][0]["code"]
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
error_message = "#{@code} - #{error_message}" if @code
|
|
10
|
+
super(error_message)
|
|
9
11
|
else
|
|
10
12
|
super(msg)
|
|
11
13
|
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Brightpearl
|
|
2
|
+
# Goods-Out Notes are used to represent stock permanently leaving your stock control system. The most common use of a Goods-Out Note is to facilitate the fulfilment of a Sales Order.
|
|
3
|
+
#
|
|
4
|
+
# When a Goods-Out Note is successfully created, stock is allocated to the specified Sales Order and is not available for the purposes of sales, Internal Transfers, External Transfers, Reservations or Stock Corrections.
|
|
5
|
+
#
|
|
6
|
+
# Unlike the majority of resources that can be manipulated via the warehouse service, Goods-Out Notes have a temporal component, represented by lifecycle events.
|
|
7
|
+
#
|
|
8
|
+
# A Goods-Out Note POST creates a Goods-Out Note with a created event, but for accounting and reporting purposes, the stock is still considered present in its original Warehouse and Locations
|
|
9
|
+
#
|
|
10
|
+
# You should issue one or more Goods-Out Note Event POSTs to add lifecycle events such as picked, packed and shipped to the Goods-Note Out. The stock is not considered to have left a Warehouse until the shipped event is added to the Goods-Note Out.
|
|
11
|
+
#
|
|
12
|
+
# A separate mechanism for creating a Goods-Out Note is provided by the External Transfer resource, which allows the movement of stock between two Warehouses
|
|
13
|
+
#
|
|
14
|
+
# https://api-docs.brightpearl.com/warehouse/goods-out-note/index.html
|
|
15
|
+
class GoodsOutNote < Resource
|
|
16
|
+
class << self
|
|
17
|
+
# You may query for goods-out notes in several different ways:
|
|
18
|
+
# * By goods-out note ID: `/order/*/goods-note/goods-out/4`
|
|
19
|
+
# * By an ID set of goods-out note IDs: `/order/*/goods-note/goods-out/4-99,1,2`
|
|
20
|
+
# * By an order ID: `/order/55/goods-note/goods-out/`
|
|
21
|
+
# * By a set of order IDs: `/order/55-90,45/goods-note/goods-out/`
|
|
22
|
+
# * By a combination of order IDs and goods-out note IDs: `/order/100-500/goods-note/goods-out/40-45`
|
|
23
|
+
# https://api-docs.brightpearl.com/warehouse/goods-out-note/get.html
|
|
24
|
+
def get(order_id_set:, gon_id_set: "")
|
|
25
|
+
url = "warehouse-service/order/#{order_id_set}/goods-note/goods-out/#{gon_id_set}"
|
|
26
|
+
send_request(path: url, method: :get)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# https://api-docs.brightpearl.com/warehouse/goods-out-note/post.html
|
|
30
|
+
def post(order_id:, **params)
|
|
31
|
+
url = "warehouse-service/order/#{order_id}/goods-note/goods-out"
|
|
32
|
+
send_request(path: url, method: :post, body: params)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# https://api-docs.brightpearl.com/warehouse/goods-out-note/put.html
|
|
36
|
+
def put(id:, **params)
|
|
37
|
+
url = "warehouse-service/goods-note/goods-out/#{id}"
|
|
38
|
+
send_request(path: url, method: :put, body: params)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# https://api-docs.brightpearl.com/warehouse/goods-out-note/delete.html
|
|
42
|
+
def delete(order_id:, gon_id:)
|
|
43
|
+
url = "warehouse-service/order/#{order_id}/goods-note/goods-out/#{gon_id}"
|
|
44
|
+
send_request(path: url, method: :delete)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# search (TODO)
|
|
48
|
+
# https://api-docs.brightpearl.com/warehouse/goods-out-note/search.html
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Brightpearl
|
|
2
|
+
# Webhooks are used to define a 'callback contract' between Brightpearl and some third-party system. They specify the circumstances under which Brightpearl should send an HTTP message to the third-party system and the format of that message.
|
|
3
|
+
#
|
|
4
|
+
# They are typically used to notify a remote server supporting some integration of a change in the state of a resource in a customer's Brightpearl account. For example, a carrier integration will want to know when Goods-Out Notes are picked or packed.
|
|
5
|
+
#
|
|
6
|
+
# Please read Brightpearl webhooks for more information on how and when to use webhooks.
|
|
7
|
+
# https://api-docs.brightpearl.com/integration/webhook/index.html
|
|
8
|
+
class Webhook < Resource
|
|
9
|
+
extend Brightpearl::APIOperations::Get # /integration-service/webhook/{ID-SET}
|
|
10
|
+
extend Brightpearl::APIOperations::Post # /integration-service/webhook
|
|
11
|
+
extend Brightpearl::APIOperations::Delete # /integration-service/webhook/{ID}
|
|
12
|
+
|
|
13
|
+
class << self
|
|
14
|
+
def resource_path
|
|
15
|
+
"integration-service/webhook"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -10,9 +10,15 @@ require 'brightpearl/resources/order_status'
|
|
|
10
10
|
require 'brightpearl/resources/order_status_update'
|
|
11
11
|
require 'brightpearl/resources/order_custom_field'
|
|
12
12
|
|
|
13
|
+
require 'brightpearl/resources/goods_out_note'
|
|
14
|
+
|
|
13
15
|
require 'brightpearl/resources/product'
|
|
14
16
|
require 'brightpearl/resources/product_price'
|
|
15
17
|
require 'brightpearl/resources/price_list'
|
|
16
18
|
require 'brightpearl/resources/product_availability'
|
|
19
|
+
|
|
20
|
+
# Integration
|
|
21
|
+
require 'brightpearl/resources/webhook'
|
|
22
|
+
|
|
17
23
|
# Accounting
|
|
18
24
|
require 'brightpearl/resources/tax_code'
|
data/lib/brightpearl/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-brightpearl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- vicvans20
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: httparty
|
|
@@ -141,6 +140,7 @@ files:
|
|
|
141
140
|
- bin/setup
|
|
142
141
|
- lib/brightpearl.rb
|
|
143
142
|
- lib/brightpearl/api_operations.rb
|
|
143
|
+
- lib/brightpearl/api_operations/delete.rb
|
|
144
144
|
- lib/brightpearl/api_operations/get.rb
|
|
145
145
|
- lib/brightpearl/api_operations/options.rb
|
|
146
146
|
- lib/brightpearl/api_operations/patch.rb
|
|
@@ -154,6 +154,7 @@ files:
|
|
|
154
154
|
- lib/brightpearl/resources.rb
|
|
155
155
|
- lib/brightpearl/resources/customer.rb
|
|
156
156
|
- lib/brightpearl/resources/customer_custom_field.rb
|
|
157
|
+
- lib/brightpearl/resources/goods_out_note.rb
|
|
157
158
|
- lib/brightpearl/resources/order.rb
|
|
158
159
|
- lib/brightpearl/resources/order_custom_field.rb
|
|
159
160
|
- lib/brightpearl/resources/order_row.rb
|
|
@@ -165,6 +166,7 @@ files:
|
|
|
165
166
|
- lib/brightpearl/resources/product_availability.rb
|
|
166
167
|
- lib/brightpearl/resources/product_price.rb
|
|
167
168
|
- lib/brightpearl/resources/tax_code.rb
|
|
169
|
+
- lib/brightpearl/resources/webhook.rb
|
|
168
170
|
- lib/brightpearl/version.rb
|
|
169
171
|
- playground.rb
|
|
170
172
|
- ruby-brightpearl.gemspec
|
|
@@ -177,7 +179,6 @@ metadata:
|
|
|
177
179
|
homepage_uri: https://github.com/vicvans20/ruby-brightpearl
|
|
178
180
|
source_code_uri: https://github.com/vicvans20/ruby-brightpearl
|
|
179
181
|
changelog_uri: https://github.com/vicvans20/ruby-brightpearl/blob/master/CHANGELOG.md
|
|
180
|
-
post_install_message:
|
|
181
182
|
rdoc_options: []
|
|
182
183
|
require_paths:
|
|
183
184
|
- lib
|
|
@@ -192,8 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
192
193
|
- !ruby/object:Gem::Version
|
|
193
194
|
version: '0'
|
|
194
195
|
requirements: []
|
|
195
|
-
rubygems_version: 3.
|
|
196
|
-
signing_key:
|
|
196
|
+
rubygems_version: 3.6.9
|
|
197
197
|
specification_version: 4
|
|
198
198
|
summary: Brightpearl API ruby client.
|
|
199
199
|
test_files: []
|