ruby-brightpearl 0.6.0 → 0.7.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: a80cab051224d81b25426eb10655cbc17a7671befe929070149f9f8f0e15d7a0
4
- data.tar.gz: f3123fd3ed140e7609c4b8001e3550442432ec7758fe9d7f1509d5950d27389e
3
+ metadata.gz: d50d3172ec36f06ca6b5ac76a9fc5f69b578df384db02b467d4c57502ede7dae
4
+ data.tar.gz: 89d67376fd2e4a6c5e007c2c6300cd657e2115b202b4f67403c1364921cdf6f0
5
5
  SHA512:
6
- metadata.gz: 3a0a2a922874b73cf68f788338c7ebf9b3b5c925a8fa211c009dd09a2e37f891b4d3bb45d5d65043907b1b4302aba4506608549debe5feb2932b65cb0cddfc21
7
- data.tar.gz: c5b1cecc26f306eddcd7be95374c809704d925fb8238afc9d2ff0c9e4058eeb45e9685aeb38c506262a80977432d274c5a886aa3c051cd085bfa8aa86d5647a1
6
+ metadata.gz: 7789dbc2a64efb929655e07def14a753246baf3ade6b7b6d3ed750da89b77abe9568ba1974634f7f22f98db54de6f379787c14d5901eddca571c0ced4ce56eb0
7
+ data.tar.gz: d259a5ead61c86d653f866bc150d5a604db202bd907b71530965d3cc27030d50e33f2fb122c0f591a971c515f07bc10c00855b1824535f0b6e9c4e0b525394a0
data/CHANGELOG.md CHANGED
@@ -1,12 +1,24 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.6.0]
3
+ ## [0.7.0] - 2025-11-03
4
+
5
+ ### Added
6
+
7
+ - New API Operation `DELETE`
8
+ - **New resource `Webhook`**
9
+ - Available operations: `GET`, `POST`, `DELETE`
10
+
11
+ ### Changed
12
+ - Improved `Brightpearl::RequestError` message to include error code when available
13
+ - For example, `CMNC-404 - Resource not found` instead of just `Resource not found`
14
+
15
+ ## [0.6.0] - 2025-08-28
4
16
 
5
17
  - New resource `Customer`
6
18
  - New resource `CustomerCustomField`
7
19
  - Minor fixes on development libs
8
20
 
9
- ## [0.5.0]
21
+ ## [0.5.0] - 2025-03-27
10
22
 
11
23
  - Add new resource OrderCustomField
12
24
  - 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.6.0)
4
+ ruby-brightpearl (0.7.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.2.2)
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.1)
22
+ httparty (0.23.2)
23
23
  csv
24
24
  mini_mime (>= 1.0.0)
25
25
  multi_xml (>= 0.5.2)
@@ -0,0 +1,9 @@
1
+ module Brightpearl
2
+ module APIOperations
3
+ module Delete
4
+ def delete(id)
5
+ send_request(path: "#{resource_path}/#{id}", method: :delete)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -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'
@@ -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
 
@@ -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
- error = response["errors"][0]["message"]
6
+ error_message = response["errors"][0]["message"]
7
7
  @code = response["errors"][0]["code"]
8
- super(error)
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,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
@@ -14,5 +14,9 @@ require 'brightpearl/resources/product'
14
14
  require 'brightpearl/resources/product_price'
15
15
  require 'brightpearl/resources/price_list'
16
16
  require 'brightpearl/resources/product_availability'
17
+
18
+ # Integration
19
+ require 'brightpearl/resources/webhook'
20
+
17
21
  # Accounting
18
22
  require 'brightpearl/resources/tax_code'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Brightpearl
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
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.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vicvans20
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-08-28 00:00:00.000000000 Z
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
@@ -165,6 +165,7 @@ files:
165
165
  - lib/brightpearl/resources/product_availability.rb
166
166
  - lib/brightpearl/resources/product_price.rb
167
167
  - lib/brightpearl/resources/tax_code.rb
168
+ - lib/brightpearl/resources/webhook.rb
168
169
  - lib/brightpearl/version.rb
169
170
  - playground.rb
170
171
  - ruby-brightpearl.gemspec
@@ -177,7 +178,6 @@ metadata:
177
178
  homepage_uri: https://github.com/vicvans20/ruby-brightpearl
178
179
  source_code_uri: https://github.com/vicvans20/ruby-brightpearl
179
180
  changelog_uri: https://github.com/vicvans20/ruby-brightpearl/blob/master/CHANGELOG.md
180
- post_install_message:
181
181
  rdoc_options: []
182
182
  require_paths:
183
183
  - lib
@@ -192,8 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  - !ruby/object:Gem::Version
193
193
  version: '0'
194
194
  requirements: []
195
- rubygems_version: 3.5.3
196
- signing_key:
195
+ rubygems_version: 3.6.9
197
196
  specification_version: 4
198
197
  summary: Brightpearl API ruby client.
199
198
  test_files: []