ruby-brightpearl 0.3.0 → 0.5.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: 36879f9ba393e143164df763df4236de07986efca7a99a7d2267e87015aa74e2
4
- data.tar.gz: 56674204c47ed147f9e8798b598f90b6c98320a5c29859112036c563d5b7c480
3
+ metadata.gz: fdb848704f153ae9ba26d219cf41f6fb2837e47e7aacb4c7f2780d4abfa7e6ce
4
+ data.tar.gz: 693496443c266b56693804e2909672306298035e7caf3d266d2b5fa808d446dc
5
5
  SHA512:
6
- metadata.gz: fe7b11761a9aa7f475f694e249c1c6bf674fbf119c31efedc0225fa5265acfbbd9b21ee16ec240aa9916f03e38696ea5380d1762b181430e8e88a43a6fcd6c7b
7
- data.tar.gz: 35042bea78d916efe48dd23d7c7d2495f39c39b4445bce7043eca7701982bfc878a01e749df170f7fb64ae135fe25fbcd17bc24307a46ee1658c5fa6425e3665
6
+ metadata.gz: a8ec1a268a3bc9cc761d7f72f04e7f3130e3edbda988e369945d3fd4c8c7fcd96d22e8c59bed0d9329805bb9c3fe9dc517d8ef2a791bc1fc493eb52bf87714a6
7
+ data.tar.gz: 45a15dfbb0f95446c6cbb0625c0ea6998a7786e2e5f39ea917689df2e67e17f05f089aa4b6d29d06a05c4f753f3ae394cb5620f9c0c8d1aff5a2ff0542b8f8a1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0]
4
+ - Add new resource OrderCustomField
5
+ - Improve test environment to use different bp credentials without breaking the cassettes
6
+
7
+ ## [0.3.0] - 2022-02-03
8
+ - New resource TaxCode
9
+ - Fix minor typos
10
+ - New optional config `debug_mode`
3
11
  ## [0.3.0] - 2022-02-03
4
12
  - New resource ProductAvailability
5
13
  ## [0.2.0] - 2022-02-02
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-brightpearl (0.3.0)
4
+ ruby-brightpearl (0.5.0)
5
5
  httparty (~> 0.20)
6
6
 
7
7
  GEM
@@ -9,18 +9,20 @@ GEM
9
9
  specs:
10
10
  addressable (2.8.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
+ bigdecimal (3.1.9)
12
13
  byebug (11.1.3)
13
14
  crack (0.4.5)
14
15
  rexml
16
+ csv (3.3.3)
15
17
  diff-lcs (1.5.0)
16
18
  hashdiff (1.0.1)
17
- httparty (0.20.0)
18
- mime-types (~> 3.0)
19
+ httparty (0.23.0)
20
+ csv
21
+ mini_mime (>= 1.0.0)
19
22
  multi_xml (>= 0.5.2)
20
- mime-types (3.4.1)
21
- mime-types-data (~> 3.2015)
22
- mime-types-data (3.2022.0105)
23
- multi_xml (0.6.0)
23
+ mini_mime (1.1.5)
24
+ multi_xml (0.7.1)
25
+ bigdecimal (~> 3.1)
24
26
  public_suffix (4.0.6)
25
27
  rake (13.0.6)
26
28
  rexml (3.2.5)
data/README.md CHANGED
@@ -119,6 +119,30 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
119
119
 
120
120
  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).
121
121
 
122
+ ## Testing
123
+
124
+ Before you can you tests, you have to setup some env variables:
125
+ * RUBY_BRIGHTPEARL_ENDPOINT: The API endpoint to use, e.g. https://ws-use.brightpearl.com
126
+ * RUBY_BRIGHTPEARL_APP_REF: The app ref to use, e.g. barulu
127
+ * RUBY_BRIGHTPEARL_DEV_REF: The dev ref to use, e.g. barulu
128
+ * RUBY_BRIGHTPEARL_ACCOUNT: The account to use, e.g. barulu
129
+ * RUBY_BRIGHTPEARL_TOKEN: The token to use, e.g. barulu
130
+
131
+ You have to fetch these yourself.
132
+
133
+ ## Release
134
+
135
+ To release a new version follow these steps:,
136
+ 1. Update CHANGELOG.md with the new version changes
137
+ 2. Update the version number in `version.rb`
138
+ 3. Execute bundle to update version on `Gemfile.lock` automatically
139
+ 4. Commit the changes and change the branch to `main`
140
+ 5. 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).
141
+
142
+ > Remember to execute `bundle exec rake release` on `main` branch
143
+ > `Gemfile.lock` update for version is done after running `bundle install` with the `version.rb` updated
144
+
145
+
122
146
  ## Contributing
123
147
 
124
148
  Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruby-brightpearl. 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]/ruby-brightpearl/blob/master/CODE_OF_CONDUCT.md).
@@ -46,7 +46,7 @@ module Brightpearl
46
46
  puts "Unrecognized http method"
47
47
  end
48
48
 
49
- puts url
49
+ puts url if Brightpearl.config.debug_mode
50
50
  json = JSON.parse(response.body)
51
51
 
52
52
  if response.code == 503 # Unavailable MOST likeyly throttled
@@ -12,5 +12,7 @@ module Brightpearl
12
12
  attr_accessor :token # API token
13
13
  attr_accessor :api_domain # API URL base. Depends on instance region. Obtained after auth process
14
14
  attr_accessor :refresh_token # API refresh token
15
+
16
+ attr_accessor :debug_mode # Display log data for request done when true
15
17
  end
16
18
  end
@@ -9,8 +9,6 @@ module Brightpearl
9
9
  else
10
10
  super(msg)
11
11
  end
12
- puts @code
13
- puts error
14
12
  @response = response
15
13
  @status = status
16
14
  end
@@ -0,0 +1,19 @@
1
+ module Brightpearl
2
+ # Order custom fields are user-defined data held against an order.
3
+ # Custom fields are defined separately for sales and purchase orders.
4
+ # Field names and data types are shared between every order of the same type. Several data types are available.
5
+ class OrderCustomField < Resource
6
+ class << self
7
+ # https://api-docs.brightpearl.com/order/order-customfields/get.html
8
+ def get(order_id)
9
+ send_request(path: "order-service/order/#{order_id}/custom-field", method: :get)
10
+ end
11
+
12
+ # https://api-docs.brightpearl.com/order/order-customfields/patch.html
13
+ def patch(order_id, params)
14
+ send_request(path: "order-service/order/#{order_id}/custom-field", method: :patch, body: params)
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -3,7 +3,7 @@ module Brightpearl
3
3
  extend Brightpearl::APIOperations::Get
4
4
  class << self
5
5
  def resource_path
6
- "warehouse-service/product-availability/"
6
+ "warehouse-service/product-availability"
7
7
  end
8
8
 
9
9
  # https://api-docs.brightpearl.com/warehouse/product-availability/get.html
@@ -0,0 +1,21 @@
1
+ module Brightpearl
2
+ class TaxCode < Resource
3
+ extend Brightpearl::APIOperations::Get
4
+ class << self
5
+ def resource_path
6
+ "accounting-service/tax-code"
7
+ end
8
+
9
+ def get(id_set = nil)
10
+ if id_set
11
+ super
12
+ else
13
+ super(nil)
14
+ end
15
+ end
16
+
17
+ # https://api-docs.brightpearl.com/accounting/tax-code/get.html
18
+
19
+ end
20
+ end
21
+ end
@@ -4,7 +4,10 @@ require 'brightpearl/resources/order_row'
4
4
  require 'brightpearl/resources/order_shipping_status'
5
5
  require 'brightpearl/resources/order_status'
6
6
  require 'brightpearl/resources/order_status_update'
7
+ require 'brightpearl/resources/order_custom_field'
7
8
  require 'brightpearl/resources/product'
8
9
  require 'brightpearl/resources/product_price'
9
10
  require 'brightpearl/resources/price_list'
10
- require 'brightpearl/resources/product_availability'
11
+ require 'brightpearl/resources/product_availability'
12
+ # Accounting
13
+ require 'brightpearl/resources/tax_code'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Brightpearl
4
- VERSION = "0.3.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-brightpearl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vicvans20
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-04 00:00:00.000000000 Z
11
+ date: 2025-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -97,6 +97,7 @@ files:
97
97
  - lib/brightpearl/resource.rb
98
98
  - lib/brightpearl/resources.rb
99
99
  - lib/brightpearl/resources/order.rb
100
+ - lib/brightpearl/resources/order_custom_field.rb
100
101
  - lib/brightpearl/resources/order_row.rb
101
102
  - lib/brightpearl/resources/order_shipping_status.rb
102
103
  - lib/brightpearl/resources/order_status.rb
@@ -105,6 +106,7 @@ files:
105
106
  - lib/brightpearl/resources/product.rb
106
107
  - lib/brightpearl/resources/product_availability.rb
107
108
  - lib/brightpearl/resources/product_price.rb
109
+ - lib/brightpearl/resources/tax_code.rb
108
110
  - lib/brightpearl/version.rb
109
111
  - playground.rb
110
112
  - ruby-brightpearl.gemspec
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  - !ruby/object:Gem::Version
133
135
  version: '0'
134
136
  requirements: []
135
- rubygems_version: 3.2.32
137
+ rubygems_version: 3.5.3
136
138
  signing_key:
137
139
  specification_version: 4
138
140
  summary: Brightpearl API ruby client.