clean-architecture 4.0.1 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b553e98f42ca8f4d8c248a3b4cd8193c139c6ec954f3a8f48159e55071ad3dd
4
- data.tar.gz: 781afce831f62564aef291aa5f78a589dd0cbf3ad08a7d12c86f6eae7b3f2817
3
+ metadata.gz: 428e702a6403538a70c6a095576f6eaf6cc3c50396369e2a6909d5a98f6b7abe
4
+ data.tar.gz: 47f51f5740280413a09444387a95dac0c5ea05aa63a1b6a3f9e34aacb43b2723
5
5
  SHA512:
6
- metadata.gz: e2dd17013e0ca6ac9500cb202544f77aec084b9c1e964f21e9eea30df993a3e834bda44118d0340b694b3c52c21836c51e6a5559571fbff1ba95a3c1cc35cb79
7
- data.tar.gz: e81fb39a065f1c993655e3de55d6e794f1f73e46a1deccee186de9ae116547291421eb92a9c488606d1cf41193d309cddc8acf131793078ce0cf97ff237b355e
6
+ metadata.gz: 934c13671b48636c3441dbde2843ae47c5e4d4b0c6dac5ae1ae347839336f04ea7f7baf600ec4003429d0a6cce81b67850bf1ab69a39b138cb01506fcf942835
7
+ data.tar.gz: 506932bad509e26d0f898ca94ff3256edf0034ac84aea2d694d249d7dbf46f80ed83d591ba2477faf6d5e34144fc235b99661f10d30cafae4438f9128104145f
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-18.04
11
11
  steps:
12
12
  - name: Checkout branch
13
- uses: actions/checkout@v1
13
+ uses: actions/checkout@v2
14
14
  - name: Extract branch name
15
15
  shell: bash
16
16
  run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
@@ -1,6 +1,10 @@
1
+ 5.0.0
2
+
3
+ * Rename persistence -> gateway to be consistent with the pattern used through our systems
4
+
1
5
  4.0.1
2
6
 
3
- * CleanArchiecture::Serializers::JsonResponseFromResult: Pass the success value to the proc
7
+ * CleanArchitecture::Serializers::JsonResponseFromResult: Pass the success value to the proc
4
8
 
5
9
  4.0.0
6
10
 
data/README.md CHANGED
@@ -97,7 +97,7 @@ We satisfy the SRP by following these rules:
97
97
 
98
98
  We satisfy the OCP, LSP & DIP by following these rules:
99
99
 
100
- - We create a clean boundary between our business logic, our persistence layer and our application-specific classes using interfaces
100
+ - We create a clean boundary between our business logic, our gateway and our application-specific classes using interfaces
101
101
  - We use interfaces wherever possible, allowing concrete implementations of those interfaces to be extended without breaking the contract
102
102
  - We write unit tests against interfaces, never against concrete implementations (unless interfaces don't exist)
103
103
 
@@ -157,7 +157,7 @@ We satisfy the SAP by:
157
157
 
158
158
  ### Practical suggestions for implementation
159
159
 
160
- * The code that manages your inputs (e.g. a Rails controller) instantiates a persistence layer
160
+ * The code that manages your inputs (e.g. a Rails controller) instantiates a gateway
161
161
  object
162
162
 
163
163
  * The code that manages your inputs (e.g. a Rails controller) instantiates a use case actor
@@ -182,7 +182,7 @@ We satisfy the SAP by:
182
182
  use_case_actor,
183
183
  TargetActiveRecordClass.find(params[:id]),
184
184
  strong_params,
185
- persistence,
185
+ gateway,
186
186
  other_settings_hash
187
187
  )
188
188
  ```
@@ -329,7 +329,7 @@ module MyBusinessDomain
329
329
  module UseCases
330
330
  class UserUpdatesNickname < CleanArchitecture::UseCases::AbstractUseCase
331
331
  contract do
332
- option :my_persistence_object
332
+ option :my_gateway_object
333
333
 
334
334
  params do
335
335
  required(:user_id).filled(:id)
@@ -339,7 +339,7 @@ module MyBusinessDomain
339
339
  rule(:nickname).validate(:not_already_taken)
340
340
 
341
341
  register_macro(:not_already_taken) do
342
- unless my_persistence_object.username_is_available?(values[key_name])
342
+ unless my_gateway_object.username_is_available?(values[key_name])
343
343
  key.failure('is already taken')
344
344
  end
345
345
  end
@@ -350,7 +350,7 @@ module MyBusinessDomain
350
350
 
351
351
  def result
352
352
  valid_params = yield result_of_validating_params
353
- context(:my_persistence_object).result_of_updating_nickname(
353
+ context(:my_gateway_object).result_of_updating_nickname(
354
354
  valid_params[:id],
355
355
  valid_params[:nickname]
356
356
  )
@@ -404,7 +404,7 @@ module MyWebApp
404
404
  def nickname_update_form
405
405
  @nickname_update_form ||= NicknameUpdateForm.new(
406
406
  params: params.permit(:user_id, :nickname),
407
- context: { my_persistence_object: MyPersistence.new }
407
+ context: { my_gateway_object: MyGateway.new }
408
408
  )
409
409
  end
410
410
  end
@@ -436,7 +436,7 @@ module MyWebApp
436
436
 
437
437
  def user_updates_nickname_parameters
438
438
  MyBusinessDomain::UseCases::UserUpdatesNickname.parameters(
439
- context: { my_persistence_object: MyPersistence.new },
439
+ context: { my_gateway_object: MyGateway.new },
440
440
  user_id: params[:user_id],
441
441
  nickname: params[:nickname]
442
442
  )
@@ -451,7 +451,7 @@ Elements of contracts can be shared amongst use cases, this can be very helpful
451
451
  module MyBusinessDomain
452
452
  module UseCases
453
453
  class SharedContract < CleanArchitecture::UseCases::Contract
454
- option :my_persistence_object
454
+ option :my_gateway_object
455
455
 
456
456
  register_macro(:not_already_taken?) do
457
457
  unless not_already_taken?(values[key_name])
@@ -462,7 +462,7 @@ module MyBusinessDomain
462
462
  private
463
463
 
464
464
  def not_already_taken?(username)
465
- my_persistence_object.username_is_available?(values[key_name])
465
+ my_gateway_object.username_is_available?(values[key_name])
466
466
  end
467
467
  end
468
468
  end
@@ -476,7 +476,7 @@ module MyBusinessDomain
476
476
  module UseCases
477
477
  class UserUpdatesNickname < CleanArchitecture::UseCases::AbstractUseCase
478
478
  contract(SharedContract) do
479
- option :my_persistence_object
479
+ option :my_gateway_object
480
480
 
481
481
  params do
482
482
  required(:user_id).filled(:id)
@@ -517,7 +517,7 @@ end
517
517
 
518
518
  ### `#context`
519
519
 
520
- Any context variables defined as `option`'s in your use case contract have to be specified whenever creating an instance of the parameter objects for your use case. In practice this means you can't accidentally forget to pass in say a persistence object / repository / factory / etc.
520
+ Any context variables defined as `option`'s in your use case contract have to be specified whenever creating an instance of the parameter objects for your use case. In practice this means you can't accidentally forget to pass in say a gateway object / repository / factory / etc.
521
521
 
522
522
  These context variables can be used within the use case using the `context` method:
523
523
 
@@ -526,7 +526,7 @@ module MyBusinessDomain
526
526
  module UseCases
527
527
  class UserUpdatesAge < CleanArchitecture::UseCases::AbstractUseCase
528
528
  contract do
529
- option :required_persistence_object
529
+ option :required_gateway_object
530
530
 
531
531
  params do
532
532
  required(:user_id).filled(:int)
@@ -539,7 +539,7 @@ module MyBusinessDomain
539
539
  def result
540
540
  valid_params = yield result_of_validating_params
541
541
 
542
- context(:required_persistence_object).update_user_age_result(
542
+ context(:required_gateway_object).update_user_age_result(
543
543
  valid_params[:user_id],
544
544
  valid_params[:age]
545
545
  )
@@ -560,7 +560,7 @@ module MyBusinessDomain
560
560
  module UseCases
561
561
  class UserUpdatesChristmasWishlist < CleanArchitecture::UseCases::AbstractUseCase
562
562
  contract do
563
- option :required_persistence_object
563
+ option :required_gateway_object
564
564
 
565
565
  params do
566
566
  required(:user_id).filled(:int)
@@ -579,7 +579,7 @@ module MyBusinessDomain
579
579
  return fail_with_error_message('Uh oh, Santa has already left the North Pole!')
580
580
  end
581
581
 
582
- context(:required_persistence_object).change_most_wanted_gift(user_id, most_wanted_gift)
582
+ context(:required_gateway_object).change_most_wanted_gift(user_id, most_wanted_gift)
583
583
  end
584
584
  end
585
585
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency 'dry-struct'
27
27
  spec.add_dependency 'dry-types'
28
28
  spec.add_dependency 'dry-validation', '>= 1.0.0'
29
- spec.add_dependency 'duckface-interfaces', '>= 0.0'
29
+ spec.add_dependency 'duckface-interfaces'
30
30
  spec.add_dependency 'sorbet-runtime'
31
31
 
32
32
  spec.add_development_dependency 'bundler'
@@ -7,16 +7,16 @@ require 'clean_architecture/interfaces/authorization_parameters'
7
7
  module CleanArchitecture
8
8
  module Entities
9
9
  class TargetedParameters
10
- attr_reader :actor, :extra_parameters_hash, :persistence, :target, :settings
10
+ attr_reader :actor, :extra_parameters_hash, :gateway, :target, :settings
11
11
 
12
12
  implements_interface Interfaces::TargetedParameters
13
13
  implements_interface Interfaces::AuthorizationParameters
14
14
 
15
- def initialize(actor, target, extra_parameters_hash, persistence, settings)
15
+ def initialize(actor, target, extra_parameters_hash, gateway, settings)
16
16
  @actor = actor
17
17
  @target = target
18
18
  @extra_parameters_hash = extra_parameters_hash
19
- @persistence = persistence
19
+ @gateway = gateway
20
20
  @settings = settings
21
21
  end
22
22
  end
@@ -6,14 +6,14 @@ require 'clean_architecture/interfaces/base_parameters'
6
6
  module CleanArchitecture
7
7
  module Entities
8
8
  class UntargetedParameters
9
- attr_reader :actor, :extra_parameters_hash, :persistence, :settings
9
+ attr_reader :actor, :extra_parameters_hash, :gateway, :settings
10
10
 
11
11
  implements_interface Interfaces::BaseParameters
12
12
 
13
- def initialize(actor, extra_parameters_hash, persistence, settings)
13
+ def initialize(actor, extra_parameters_hash, gateway, settings)
14
14
  @actor = actor
15
15
  @extra_parameters_hash = extra_parameters_hash
16
- @persistence = persistence
16
+ @gateway = gateway
17
17
  @settings = settings
18
18
  end
19
19
  end
@@ -12,7 +12,7 @@ module CleanArchitecture
12
12
  raise NotImplementedError
13
13
  end
14
14
 
15
- def persistence
15
+ def gateway
16
16
  raise NotImplementedError
17
17
  end
18
18
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module CleanArchitecture
5
- VERSION = '4.0.1'
5
+ VERSION = '5.0.1'
6
6
  end
@@ -195,7 +195,7 @@
195
195
  # wrong constant name define_attribute_method
196
196
  # wrong constant name define_attribute_methods
197
197
  # wrong constant name undefine_attribute_methods
198
- # undefined method `initialize<defaultArg>1' for class `#<Class:0x00007fc1ce88af08>'
198
+ # undefined method `initialize<defaultArg>1' for class `#<Class:0x00007ff444bf9218>'
199
199
  # wrong constant name <Class:AttributeMethodMatch>
200
200
  # wrong constant name initialize<defaultArg>1
201
201
  # wrong constant name initialize
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clean-architecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bellroy Tech Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0.0'
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '0.0'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sorbet-runtime
127
127
  requirement: !ruby/object:Gem::Requirement