cin7_api 1.0.4 → 1.0.5

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: def4242ec47be664686584c99a2375d3c349c3e30410caac8e42a0ae2ad24089
4
- data.tar.gz: f71f8db45c6efec4c24252c9a5ee25050bc79b9626f64787213d68c6625807ce
3
+ metadata.gz: 0553e1a9d4db6501e28ed87aa824a5e58ce79171917f04f7d3c9fb72cb35454e
4
+ data.tar.gz: d71205d4103dc6eecaaf6fa6b4b1465e8ff14e3e4b017edfa0d9daa24e7452d6
5
5
  SHA512:
6
- metadata.gz: 2e0bc2731ab0ec35e5d45efa3d748310b27833ccdaf76490a8272858608da8143db299119841d1a4b03e1ea36799e09e2a483aea15fd187857c76c77e5a15c47
7
- data.tar.gz: bb2e02999a87823610ffc55037a6c1ad06752bdd9df89be4c2d35046f956d1605f9e1856d1a8e2b917d13ef5105231f89d807fc9c9fff734543503e80ace8621
6
+ metadata.gz: a19008caf61d33c068423f9aa656d5eba3348d2b262bdc044f7914a395385bf9465244a281b5173c0272170c556acb20ea287f24acd02bc48f2af6608424f476
7
+ data.tar.gz: 69a986ad34adda010c8075166e031ef3e1a56411d7e904498f2c4bee318fb0250b4fd36b77773b4c4f0cf6bdc5bdff5a8297c3f3d1ee9b877fed6c9ad674d2ba
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cin7_api (1.0.4)
4
+ cin7_api (1.0.5)
5
5
  activesupport
6
6
  faraday (~> 2.5)
7
7
  zeitwerk
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cin7API
4
+ class Error < StandardError
5
+ end
6
+
7
+ class ServerError < StandardError
8
+ end
9
+
10
+ class RateLimitError < StandardError
11
+ end
12
+ end
@@ -35,9 +35,9 @@ module Cin7API
35
35
  when 404
36
36
  raise Error, "The resource you have specified cannot be found. #{error_message}"
37
37
  when 429
38
- raise Error, "The API rate limit for your application has been exceeded. #{error_message}"
38
+ raise RateLimitError, "The API rate limit for your application has been exceeded. #{error_message}"
39
39
  when 500
40
- raise Error,
40
+ raise ServerError,
41
41
  "An unhandled error with the Cin7 API. Contact the Cin7 API team if problems persist. #{error_message}"
42
42
  when 503
43
43
  raise Error,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cin7API
4
- VERSION = "1.0.4"
4
+ VERSION = "1.0.5"
5
5
  end
data/lib/cin7_api.rb CHANGED
@@ -7,7 +7,12 @@ loader = Zeitwerk::Loader.for_gem
7
7
  loader.inflector.inflect("cin7_api" => "Cin7API")
8
8
  loader.collapse("#{__dir__}/cin7_api/objects")
9
9
  loader.collapse("#{__dir__}/cin7_api/resources")
10
- loader.setup # ready!
10
+ # Zeitwerk doesn't support multiple classes in a single file
11
+ # https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#one-file-one-constant-at-the-same-top-level
12
+ loader.ignore("#{__dir__}/cin7_api/errors.rb")
13
+ loader.setup
14
+
15
+ require "cin7_api/errors"
11
16
 
12
17
  module Cin7API
13
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cin7_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wei Zhe Heng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-11 00:00:00.000000000 Z
11
+ date: 2022-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -113,7 +113,7 @@ files:
113
113
  - Rakefile
114
114
  - lib/cin7_api.rb
115
115
  - lib/cin7_api/client.rb
116
- - lib/cin7_api/error.rb
116
+ - lib/cin7_api/errors.rb
117
117
  - lib/cin7_api/object.rb
118
118
  - lib/cin7_api/objects/credit_note.rb
119
119
  - lib/cin7_api/objects/payment.rb
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Cin7API
4
- class Error < StandardError; end
5
- end