salestation 4.0.3 → 4.1.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/lib/salestation/app/errors.rb +12 -12
- data/lib/salestation/web/responses.rb +13 -5
- data/salestation.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68e2a18e5e9afcefd5ebec1ff8ed6fce053049fc71dbc04ef863662810fbcc69
|
4
|
+
data.tar.gz: 935756c02ffb2d60138c3be7b8506215ed0b9a720e85c6e606751eb71b13ebd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb946c7702e75dc9c00f4bbf80f758a7ec5cde1501d6e7b36e6093a500a854ba5a209a1d62973c113aa7534cb7d620be82ad27f0cccad32b6adb774d8e5d26a
|
7
|
+
data.tar.gz: 9aaf105fa50b0e82e3fcd613e53d2dba9023930ada4281edcf53cc1be5ee6cdb44966c02bedb5a0f6a6cb3bd306d9dd40dd56dcc2a6891679a23b2f139d0f9f7
|
@@ -12,44 +12,44 @@ module Salestation
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class InvalidInput < Error
|
15
|
-
attribute :errors, Types::Strict::Hash
|
16
|
-
attribute :hints, Types::Coercible::Hash.default({}.freeze)
|
15
|
+
attribute? :errors, Types::Strict::Hash
|
16
|
+
attribute? :hints, Types::Coercible::Hash.default({}.freeze)
|
17
17
|
attribute? :debug_message, Types::Strict::String
|
18
18
|
attribute? :form_errors, Types::Strict::Bool.default(false)
|
19
19
|
end
|
20
20
|
|
21
21
|
class DependencyCurrentlyUnavailable < Error
|
22
|
-
attribute :message, Types::Strict::String
|
22
|
+
attribute? :message, Types::Strict::String
|
23
23
|
attribute? :debug_message, Types::Strict::String
|
24
24
|
end
|
25
25
|
|
26
26
|
class RequestedResourceNotFound < Error
|
27
|
-
attribute :message, Types::Strict::String
|
27
|
+
attribute? :message, Types::Strict::String
|
28
28
|
attribute? :debug_message, Types::Strict::String
|
29
29
|
end
|
30
30
|
|
31
31
|
class Forbidden < Error
|
32
|
-
attribute :message, Types::Strict::String
|
32
|
+
attribute? :message, Types::Strict::String
|
33
33
|
attribute? :debug_message, Types::Strict::String
|
34
34
|
end
|
35
35
|
|
36
36
|
class Conflict < Error
|
37
|
-
attribute :message, Types::Strict::String
|
38
|
-
attribute :debug_message, Types::Strict::String
|
37
|
+
attribute? :message, Types::Strict::String
|
38
|
+
attribute? :debug_message, Types::Strict::String
|
39
39
|
end
|
40
40
|
|
41
41
|
class NotAcceptable < Error
|
42
|
-
attribute :message, Types::Strict::String
|
43
|
-
attribute :debug_message, Types::Strict::String
|
42
|
+
attribute? :message, Types::Strict::String
|
43
|
+
attribute? :debug_message, Types::Strict::String
|
44
44
|
end
|
45
45
|
|
46
46
|
class UnsupportedMediaType < Error
|
47
|
-
attribute :message, Types::Strict::String
|
48
|
-
attribute :debug_message, Types::Strict::String
|
47
|
+
attribute? :message, Types::Strict::String
|
48
|
+
attribute? :debug_message, Types::Strict::String
|
49
49
|
end
|
50
50
|
|
51
51
|
class RequestEntityTooLarge < Error
|
52
|
-
attribute :message, Types::Strict::String
|
52
|
+
attribute? :message, Types::Strict::String
|
53
53
|
attribute? :debug_message, Types::Strict::String
|
54
54
|
end
|
55
55
|
end
|
@@ -31,15 +31,23 @@ module Salestation
|
|
31
31
|
|
32
32
|
class Error < Response
|
33
33
|
attribute :status, Types::Strict::Integer
|
34
|
-
attribute :message, Types::
|
35
|
-
attribute :debug_message, Types::Coercible::String.default('')
|
34
|
+
attribute? :message, Types::String.optional
|
35
|
+
attribute? :debug_message, Types::Coercible::String.default('')
|
36
36
|
attribute :context, Types::Hash.default({}.freeze)
|
37
37
|
attribute :headers, Types::Hash.default({}.freeze)
|
38
38
|
attribute? :base_error, Types::Coercible::Hash
|
39
39
|
|
40
40
|
def body
|
41
41
|
# Merge into `base_error` to ensure standard fields are not overriden
|
42
|
-
(base_error || {}
|
42
|
+
merge_not_nil(base_error || {}, :message, message)
|
43
|
+
.merge(debug_message: debug_message)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def merge_not_nil(map, key, value)
|
49
|
+
map[key] = value if value
|
50
|
+
map
|
43
51
|
end
|
44
52
|
end
|
45
53
|
|
@@ -59,8 +67,8 @@ module Salestation
|
|
59
67
|
|
60
68
|
class UnprocessableEntityFromSchemaErrors
|
61
69
|
def self.create(errors:, hints:, base_error: nil, form_errors: false)
|
62
|
-
message = parse_errors(errors)
|
63
|
-
debug_message = parse_hints(hints)
|
70
|
+
message = errors ? parse_errors(errors) : nil
|
71
|
+
debug_message = hints ? parse_hints(hints) : nil
|
64
72
|
|
65
73
|
UnprocessableEntity.new(
|
66
74
|
message: message,
|
data/salestation.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salestation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glia TechMovers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|