treaty 0.4.0 → 0.6.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/README.md +2 -2
- data/config/locales/en.yml +17 -1
- data/lib/treaty/exceptions/execution.rb +1 -1
- data/lib/treaty/request/factory.rb +2 -2
- data/lib/treaty/response/factory.rb +2 -2
- data/lib/treaty/version.rb +1 -1
- data/lib/treaty/versions/execution/request.rb +4 -4
- 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: d1917cdb2d494999973e0791ff341457fc4721dd08c5e02f08fb26c1918c1fb0
|
|
4
|
+
data.tar.gz: 1e3ec37bf3bcd81e29c10afa5e8229b2ce80e920baad407f8b32ca17fb14e987
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14f558348b67d7ebbe64f19daaa952eabf127b21b466f45ca52da0ca66ff4ac83e7a370df14238ecbce3da0535216d41a3033f6d8c7359985129dc713e93152c
|
|
7
|
+
data.tar.gz: 7190e87b3c29912d51f77bc1765e44fcadb738eb807275bf8e84a54a0398ff259db94b15ad77bec8fbf0810e67d25ee864d96d2c2c0fdd3c93092add43e0489c
|
data/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<div align="center">
|
|
7
7
|
|
|
8
8
|
[](https://rubygems.org/gems/treaty)
|
|
9
|
-
[](https://github.com/servactory/
|
|
9
|
+
[](https://github.com/servactory/treaty/releases)
|
|
10
10
|
[](https://rubygems.org/gems/treaty)
|
|
11
|
-

|
|
11
|
+
[](https://www.ruby-lang.org)
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
data/config/locales/en.yml
CHANGED
|
@@ -55,6 +55,22 @@ en:
|
|
|
55
55
|
apply_defaults_not_implemented: "%{class} must implement #apply_defaults!"
|
|
56
56
|
process_nested_not_implemented: "%{class} must implement #process_nested_attributes"
|
|
57
57
|
|
|
58
|
+
# ============================================================================
|
|
59
|
+
# Request: Request definition and structure
|
|
60
|
+
# ============================================================================
|
|
61
|
+
request:
|
|
62
|
+
# Request factory DSL
|
|
63
|
+
factory:
|
|
64
|
+
unknown_method: "Unknown method '%{method}' in request definition. Use 'scope :name do ... end' to define request structure"
|
|
65
|
+
|
|
66
|
+
# ============================================================================
|
|
67
|
+
# Response: Response definition and structure
|
|
68
|
+
# ============================================================================
|
|
69
|
+
response:
|
|
70
|
+
# Response factory DSL
|
|
71
|
+
factory:
|
|
72
|
+
unknown_method: "Unknown method '%{method}' in response definition. Use 'scope :name do ... end' to define response structure"
|
|
73
|
+
|
|
58
74
|
# ============================================================================
|
|
59
75
|
# Versioning: API version management and resolution
|
|
60
76
|
# ============================================================================
|
|
@@ -68,7 +84,7 @@ en:
|
|
|
68
84
|
# Version factory
|
|
69
85
|
factory:
|
|
70
86
|
invalid_default_option: "Default option for version must be true, false, or a Proc, got: %{type}"
|
|
71
|
-
unknown_method: "Unknown method
|
|
87
|
+
unknown_method: "Unknown method '%{method}' in version definition. Available methods: summary, strategy, deprecated, request, response, delegate_to"
|
|
72
88
|
|
|
73
89
|
# Strategy validation
|
|
74
90
|
strategy:
|
|
@@ -37,7 +37,7 @@ module Treaty
|
|
|
37
37
|
# # Servactory service error
|
|
38
38
|
# begin
|
|
39
39
|
# executor.call!(params: validated_params)
|
|
40
|
-
# rescue
|
|
40
|
+
# rescue Servactory::Exceptions::Input => e
|
|
41
41
|
# raise Treaty::Exceptions::Execution, I18n.t("treaty.execution.servactory_input_error", message: e.message)
|
|
42
42
|
# end
|
|
43
43
|
# ```
|
|
@@ -20,8 +20,8 @@ module Treaty
|
|
|
20
20
|
##########################################################################
|
|
21
21
|
|
|
22
22
|
def method_missing(name, *, &_block)
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
raise Treaty::Exceptions::MethodName,
|
|
24
|
+
I18n.t("treaty.request.factory.unknown_method", method: name)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def respond_to_missing?(name, *)
|
|
@@ -26,8 +26,8 @@ module Treaty
|
|
|
26
26
|
##########################################################################
|
|
27
27
|
|
|
28
28
|
def method_missing(name, *, &_block)
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
raise Treaty::Exceptions::MethodName,
|
|
30
|
+
I18n.t("treaty.response.factory.unknown_method", method: name)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def respond_to_missing?(name, *)
|
data/lib/treaty/version.rb
CHANGED
|
@@ -98,16 +98,16 @@ module Treaty
|
|
|
98
98
|
|
|
99
99
|
def execute_servactory # rubocop:disable Metrics/MethodLength
|
|
100
100
|
executor.call!(params: @validated_params)
|
|
101
|
-
rescue
|
|
101
|
+
rescue Servactory::Exceptions::Input => e
|
|
102
102
|
raise Treaty::Exceptions::Execution,
|
|
103
103
|
I18n.t("treaty.execution.servactory_input_error", message: e.message)
|
|
104
|
-
rescue
|
|
104
|
+
rescue Servactory::Exceptions::Internal => e
|
|
105
105
|
raise Treaty::Exceptions::Execution,
|
|
106
106
|
I18n.t("treaty.execution.servactory_internal_error", message: e.message)
|
|
107
|
-
rescue
|
|
107
|
+
rescue Servactory::Exceptions::Output => e
|
|
108
108
|
raise Treaty::Exceptions::Execution,
|
|
109
109
|
I18n.t("treaty.execution.servactory_output_error", message: e.message)
|
|
110
|
-
rescue
|
|
110
|
+
rescue Servactory::Exceptions::Failure => e
|
|
111
111
|
raise Treaty::Exceptions::Execution,
|
|
112
112
|
I18n.t("treaty.execution.servactory_failure_error", message: e.message)
|
|
113
113
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: treaty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anton Sokolov
|
|
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
236
236
|
- !ruby/object:Gem::Version
|
|
237
237
|
version: '0'
|
|
238
238
|
requirements: []
|
|
239
|
-
rubygems_version: 3.
|
|
239
|
+
rubygems_version: 3.7.2
|
|
240
240
|
specification_version: 4
|
|
241
241
|
summary: A Ruby library for defining and managing REST API contracts with versioning
|
|
242
242
|
support
|