servactory 1.8.6 → 1.8.7

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: 63d469613e34fcd13e27dc8fb62fa6c36fc25cf9b9e35f5b21af30013ac75993
4
- data.tar.gz: e3edd5a0bfbd2b889e81be1aeeaa836f80c6e9925c65e5f4ed09ce2a35d44673
3
+ metadata.gz: e1be37829a79065ae8dcecc340fbecb58a1fcd15739221b38cf57474e371f3e5
4
+ data.tar.gz: beed9c07d4ed8772da258084c320f0f278e5170169971abe4497a3863eb59399
5
5
  SHA512:
6
- metadata.gz: 774bb94eb10a8695cde168e8cd7bc224ebc65804e2092c617dacf471612d1b3980dbc2f6d80b0418f9885a4697587c9d2d12c4172b176d79de4d6114f5198aed
7
- data.tar.gz: 2987a6379e4404e1757e4cef6749ae3e5fd8b98712d23e630b1b0a5bde5cdac8232046089d59cc1e642b7a540a9def431dfc6708e3696a14b517ce22cd1025f7
6
+ metadata.gz: 03a6c5da26c496b0d96a7ae51cbd85e1cc70e318222db1561add7d91fa27f0278c160129735b3e65ac9165eb440a5ec3fe33c4f2390e7e33c95997521c185203
7
+ data.tar.gz: 73772169c25d6d2eeb45a4032bb47ce0a6f47dad6e05102a2f2512fa33eaf9c13bdcdcc665e84f7e2660c169ba683919921f497708967b2bbd3b5b221a28a7b9
data/README.md CHANGED
@@ -1,9 +1,21 @@
1
- # Servactory
2
-
3
- A set of tools for building reliable services of any complexity.
4
-
5
- [![Gem version](https://img.shields.io/gem/v/servactory?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/servactory)
6
- [![Release Date](https://img.shields.io/github/release-date/afuno/servactory)](https://github.com/afuno/servactory/releases)
1
+ <p align="center">
2
+ <a href="https://servactory.com" target="_blank">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/servactory/servactory/main/.github/logo-dark.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/servactory/servactory/main/.github/logo-light.svg">
6
+ <img alt="Servactory" src="https://raw.githubusercontent.com/servactory/servactory/main/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
7
+ </picture>
8
+ </a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ A set of tools for building reliable services of any complexity.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://rubygems.org/gems/servactory"><img src="https://img.shields.io/gem/v/servactory?logo=rubygems&logoColor=fff" alt="Gem version"></a>
17
+ <a href="https://github.com/afuno/servactory/releases"><img src="https://img.shields.io/github/release-date/afuno/servactory" alt="Release Date"></a>
18
+ </p>
7
19
 
8
20
  ## Documentation
9
21
 
@@ -31,3 +31,6 @@ en:
31
31
  tools:
32
32
  conflicts:
33
33
  error: "[%{service_class_name}] Conflict between internal and output attributes `%{overlapping_attributes}`"
34
+ methods:
35
+ call:
36
+ not_used: Nothing to perform. Use `make` or create a `call` method
@@ -75,6 +75,15 @@ module Servactory
75
75
  @collection_of_outputs = collection_of_outputs
76
76
  end
77
77
 
78
+ def call
79
+ raise Servactory.configuration.failure_class.new(
80
+ message: I18n.t(
81
+ "servactory.methods.call.not_used",
82
+ service_class_name: self.class.name
83
+ )
84
+ )
85
+ end
86
+
78
87
  def service_storage
79
88
  @service_storage ||= { internals: {}, outputs: {} }
80
89
  end
@@ -17,13 +17,19 @@ module Servactory
17
17
  private_constant :DEFAULT_MESSAGE
18
18
 
19
19
  def self.check(context:, input:, value:, check_key:, **)
20
- return unless should_be_checked_for?(input, check_key)
20
+ return unless should_be_checked_for?(input, value, check_key)
21
21
 
22
22
  new(context: context, input: input, value: value).check
23
23
  end
24
24
 
25
- def self.should_be_checked_for?(input, check_key)
26
- check_key == :inclusion && input.inclusion_present?
25
+ def self.should_be_checked_for?(input, value, check_key)
26
+ check_key == :inclusion && (
27
+ input.required? || (
28
+ input.optional? && !input.default.nil?
29
+ ) || (
30
+ input.optional? && !value.nil?
31
+ )
32
+ )
27
33
  end
28
34
 
29
35
  ##########################################################################
@@ -14,7 +14,7 @@ module Servactory
14
14
  end
15
15
 
16
16
  def run!
17
- return try_to_use_call if @collection_of_stages.empty?
17
+ return use_call if @collection_of_stages.empty?
18
18
 
19
19
  @collection_of_stages.sorted_by_position.each do |stage|
20
20
  call_stage(stage)
@@ -23,8 +23,8 @@ module Servactory
23
23
 
24
24
  private
25
25
 
26
- def try_to_use_call
27
- @context.try(:send, :call)
26
+ def use_call
27
+ @context.send(:call)
28
28
  end
29
29
 
30
30
  def call_stage(stage)
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 8
7
- PATCH = 6
7
+ PATCH = 7
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.6
4
+ version: 1.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-04 00:00:00.000000000 Z
11
+ date: 2023-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport