glia-errors 0.13.0 → 0.14.1

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: 75bb40adb6fce2b0a2b5388d30c01d281a87722926709b3a1297a327e5cfb450
4
- data.tar.gz: d8404ba18f6e9b45035989ae6d22491014b476721195bec83e9217c94114c8c7
3
+ metadata.gz: ed191a541738bdb411e948565ed5a52047b4e091137843353306212965ac13c0
4
+ data.tar.gz: 00e89550af7bd420ccd503031790d39a40fec53a30004213f1d8dea05c731c50
5
5
  SHA512:
6
- metadata.gz: c6892d2c4db86ff5baf559d797255fc3cc5d8617330777c7123cc22be4795bc3a1dff13a2672faa14f75ac659f05f40bd12df18ad3e77b5e396571eaa0a2dddc
7
- data.tar.gz: 517bbdd25581e00d43da36bc96f19113270fa56535068e5019d3306489e04ff300477197a392bdd0adbfc13535159d1cda17069e3924b659bc3c1439dff5e09d
6
+ metadata.gz: 7c829ab7ae9521732d506c329998cb361ea75e33228b9ed75a235056fb2e0e3b9784cfaae5db83b2bf5582799ef45e878735985b26e8faa59d299f02c6053744
7
+ data.tar.gz: e873b734312305383851a5c24d171fb1a7082d4c644ffb60c9c03ec7bf5a501f1b14705e01263254ff222cffa785428394859a5485741a440ed9af255cc09ede
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'dry-validation', '~> 1.8'
7
+ gem 'dry-validation', '~> 1.10'
8
8
  gem 'prettier', '~> 0.22'
9
9
  gem 'rake', '~> 13.0'
10
10
  gem 'rspec', '~> 3.10'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- glia-errors (0.11.10)
4
+ glia-errors (0.14.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -10,38 +10,38 @@ GEM
10
10
  attr_extras (6.2.5)
11
11
  concurrent-ruby (1.1.10)
12
12
  diff-lcs (1.5.0)
13
- dry-configurable (0.14.0)
13
+ dry-configurable (1.0.1)
14
+ dry-core (~> 1.0, < 2)
15
+ zeitwerk (~> 2.6)
16
+ dry-core (1.0.0)
14
17
  concurrent-ruby (~> 1.0)
15
- dry-core (~> 0.6)
16
- dry-container (0.9.0)
17
- concurrent-ruby (~> 1.0)
18
- dry-configurable (~> 0.13, >= 0.13.0)
19
- dry-core (0.7.1)
20
- concurrent-ruby (~> 1.0)
21
- dry-inflector (0.2.1)
18
+ zeitwerk (~> 2.6)
19
+ dry-inflector (1.0.0)
22
20
  dry-initializer (3.1.1)
23
- dry-logic (1.2.0)
21
+ dry-logic (1.5.0)
24
22
  concurrent-ruby (~> 1.0)
25
- dry-core (~> 0.5, >= 0.5)
26
- dry-schema (1.9.1)
23
+ dry-core (~> 1.0, < 2)
24
+ zeitwerk (~> 2.6)
25
+ dry-schema (1.13.0)
27
26
  concurrent-ruby (~> 1.0)
28
- dry-configurable (~> 0.13, >= 0.13.0)
29
- dry-core (~> 0.5, >= 0.5)
27
+ dry-configurable (~> 1.0, >= 1.0.1)
28
+ dry-core (~> 1.0, < 2)
30
29
  dry-initializer (~> 3.0)
31
- dry-logic (~> 1.0)
32
- dry-types (~> 1.5)
33
- dry-types (1.5.1)
30
+ dry-logic (>= 1.5, < 2)
31
+ dry-types (>= 1.7, < 2)
32
+ zeitwerk (~> 2.6)
33
+ dry-types (1.7.0)
34
34
  concurrent-ruby (~> 1.0)
35
- dry-container (~> 0.3)
36
- dry-core (~> 0.5, >= 0.5)
37
- dry-inflector (~> 0.1, >= 0.1.2)
38
- dry-logic (~> 1.0, >= 1.0.2)
39
- dry-validation (1.8.0)
35
+ dry-core (~> 1.0, < 2)
36
+ dry-inflector (~> 1.0, < 2)
37
+ dry-logic (>= 1.4, < 2)
38
+ zeitwerk (~> 2.6)
39
+ dry-validation (1.10.0)
40
40
  concurrent-ruby (~> 1.0)
41
- dry-container (~> 0.7, >= 0.7.1)
42
- dry-core (~> 0.5, >= 0.5)
41
+ dry-core (~> 1.0, < 2)
43
42
  dry-initializer (~> 3.0)
44
- dry-schema (~> 1.9, >= 1.9.1)
43
+ dry-schema (>= 1.12, < 2)
44
+ zeitwerk (~> 2.6)
45
45
  optimist (3.0.1)
46
46
  parallel (1.22.1)
47
47
  parser (3.1.1.0)
@@ -87,13 +87,14 @@ GEM
87
87
  diff-lcs
88
88
  patience_diff
89
89
  unicode-display_width (2.1.0)
90
+ zeitwerk (2.6.6)
90
91
 
91
92
  PLATFORMS
92
93
  ruby
93
94
  x86_64-darwin-19
94
95
 
95
96
  DEPENDENCIES
96
- dry-validation (~> 1.8)
97
+ dry-validation (~> 1.10)
97
98
  glia-errors!
98
99
  prettier (~> 0.22)
99
100
  rake (~> 13.0)
data/README.md CHANGED
@@ -114,7 +114,7 @@ A Github Action will push the `.gem` file to [rubygems.org](https://rubygems.org
114
114
  ### Testing
115
115
 
116
116
  ```
117
- bundle exec rake test
117
+ bundle exec rake spec
118
118
  ```
119
119
 
120
120
  ### Formatting
data/catalog-info.yaml ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ apiVersion: backstage.io/v1alpha1
3
+ kind: Component
4
+ metadata:
5
+ name: glia-errors-ruby
6
+ description: Implements Glia errors in Ruby and provides utilities to easily construct them.
7
+ annotations:
8
+ github.com/project-slug: salemove/glia-errors
9
+ github.com/team-slug: salemove/tm-movers
10
+ snyk.io/org-name: glia-movers
11
+ tags:
12
+ - ruby
13
+ spec:
14
+ type: library
15
+ lifecycle: production
16
+ owner: tm-messenger
data/glia-errors.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'glia-errors'
8
- spec.version = '0.13.0'
8
+ spec.version = '0.14.1'
9
9
  spec.authors = ['Glia TechMovers']
10
10
  spec.email = ['techmovers@glia.com']
11
11
 
@@ -207,6 +207,20 @@ module Glia
207
207
  end
208
208
  end
209
209
 
210
+ class ResourceLockedError < Error
211
+ def initialize(resource:, locked_by: nil, message: nil)
212
+ Naming.assert_snake_case(resource)
213
+
214
+ is_locked_by = locked_by.nil? ? '' : "Locked by: #{locked_by}"
215
+ super(
216
+ type: RESOURCE_LOCKED,
217
+ ref: create_ref(RESOURCE_LOCKED),
218
+ message: message || "#{Naming.humanize(resource)} is locked. #{is_locked_by}",
219
+ error_details: { resource: resource, locked_by: locked_by }
220
+ )
221
+ end
222
+ end
223
+
210
224
  class ResourceAlreadyExistsError < Error
211
225
  def initialize(resource:, message: nil)
212
226
  Naming.assert_snake_case(resource)
@@ -16,6 +16,7 @@ module Glia
16
16
  REMAINING_ASSOCIATION_ERROR = 'remaining_association_error'
17
17
  RESOURCE_LIMIT_EXCEEDED_ERROR = 'resource_limit_exceeded_error'
18
18
  RESOURCE_MINIMUM_NOT_REACHED = 'resource_minimum_not_reached'
19
+ RESOURCE_LOCKED = 'resource_locked'
19
20
  RESOURCE_ALREADY_EXISTS_ERROR = 'resource_already_exists_error'
20
21
  INVALID_RESOURCE_STATE_ERROR = 'invalid_resource_state_error'
21
22
  AUTHORIZATION_ERROR = 'authorization_error'
data/lib/glia/errors.rb CHANGED
@@ -14,7 +14,7 @@ module Glia
14
14
 
15
15
  # When updating supported version ensure that if new version contains new dry-validation new validations
16
16
  # that they are correctly mapped to Glia errors in mapper.rb
17
- unless dry_validation_version >= Gem::Version.new('1.0') && dry_validation_version < Gem::Version.new('1.9')
17
+ unless dry_validation_version >= Gem::Version.new('1.0') && dry_validation_version < Gem::Version.new('1.11')
18
18
  raise 'Unsupported dry-validation version'
19
19
  end
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glia-errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email:
@@ -23,11 +23,11 @@ files:
23
23
  - ".rspec"
24
24
  - ".rubocop.yml"
25
25
  - ".ruby-version"
26
- - ".travis.yml"
27
26
  - Gemfile
28
27
  - Gemfile.lock
29
28
  - README.md
30
29
  - Rakefile
30
+ - catalog-info.yaml
31
31
  - glia-errors.gemspec
32
32
  - lib/glia/errors.rb
33
33
  - lib/glia/errors/client_errors.rb
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  requirements: []
61
- rubygems_version: 3.1.2
61
+ rubygems_version: 3.3.5
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Glia REST API errors
data/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- language: ruby
2
- dist: trusty
3
- rvm:
4
- - 2.5.0
5
- before_install:
6
- - gem install bundler:2.2.0
7
- before_script:
8
- - nvm install 12
9
- - nvm use 12
10
- - bundle
11
- gemfile:
12
- - gemfiles/dry_validation_v1.gemfile
13
- script: bundle exec rake