clean-architecture 1.2.0 → 2.0.0

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
- SHA1:
3
- metadata.gz: 0e9b17c830a7278ecdabf96ed831ec41e730bbdd
4
- data.tar.gz: 1d4f68de0700753e6163d560a7f6c0d80380b5f8
2
+ SHA256:
3
+ metadata.gz: cff6e5d81156369ad42cbb55c06b1931b4949da5c1c3c1a80a2425d3307b459f
4
+ data.tar.gz: 6fa2e337acd93963c6fa915f70a4109b81ec2540721b086416a275b981593eac
5
5
  SHA512:
6
- metadata.gz: c7b8bf9a4f6297c0da3843c068b0741c9e33fbd214c7a64d1084df576e5238c2934064c725527fe55f3287cb5fcada3ee75b5e31ef996117915078638d557af1
7
- data.tar.gz: 433a2e52b95353e0b1f00f1f3c6ea1fbbfaddb1fd3bf21239277bdf92b8c63f422f1432012b3c044587325afacf5dc5d572c7d8db4c1eda08dc333f5a9e9af8b
6
+ metadata.gz: ec3751be4de839c3887ec1f4ca3a7ed3f7c6abe3068cdccfa12976f93cf8882416731e74be99507e555607889f1521145b17d46e435cfa9702370bca3492f0fc
7
+ data.tar.gz: 46d4eb2641a76e284265d54c870ecc695381befd52c3f786eee87703aa5081cb8fdb64fee34aedb38de0dcf9dd0e4c87920bd7b6b6c6bf36010c2903b1ed2e4d
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  coverage
2
+ tags
@@ -1,3 +1,7 @@
1
+ 2.0.0
2
+
3
+ * Support collections for use case targets and success payloads
4
+
1
5
  1.2.0
2
6
 
3
7
  * Support arrays being passed as failure value to UseCaseResult matcher
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clean-architecture (1.2.0)
4
+ clean-architecture (2.0.0)
5
5
  dry-matcher (~> 0.0)
6
6
  dry-monads (~> 1.0)
7
7
  dry-struct (~> 0.0)
@@ -22,7 +22,7 @@ GEM
22
22
  coderay (1.1.2)
23
23
  coercible (1.0.0)
24
24
  descendants_tracker (~> 0.0.1)
25
- concurrent-ruby (1.0.5)
25
+ concurrent-ruby (1.1.3)
26
26
  descendants_tracker (0.0.4)
27
27
  thread_safe (~> 0.3, >= 0.3.1)
28
28
  diff-lcs (1.3)
@@ -184,4 +184,4 @@ DEPENDENCIES
184
184
  timecop
185
185
 
186
186
  BUNDLED WITH
187
- 1.16.4
187
+ 1.17.1
@@ -7,7 +7,7 @@ module CleanArchitecture
7
7
  module SuccessPayload
8
8
  extend Duckface::ActsAsInterface
9
9
 
10
- def data_hash
10
+ def data
11
11
  raise NotImplementedError
12
12
  end
13
13
 
@@ -4,4 +4,5 @@
4
4
 
5
5
  require 'clean_architecture/serializers/html_response_from_result'
6
6
  require 'clean_architecture/serializers/json_response_from_result'
7
+ require 'clean_architecture/serializers/success_collection_payload'
7
8
  require 'clean_architecture/serializers/success_payload'
@@ -44,7 +44,7 @@ module CleanArchitecture
44
44
  def success_payload
45
45
  {
46
46
  jsonapi: json_api_version_hash,
47
- data: @success_payload.data_hash
47
+ data: @success_payload.data
48
48
  }
49
49
  end
50
50
 
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'duckface'
4
+ require 'clean_architecture/interfaces/success_payload'
5
+ require 'clean_architecture/serializers/success_payload'
6
+
7
+ module CleanArchitecture
8
+ module Serializers
9
+ class SuccessCollectionPayload
10
+ implements_interface CleanArchitecture::Interfaces::SuccessPayload
11
+
12
+ def initialize(collection, use_case_target_class)
13
+ @collection = collection
14
+ @use_case_target_class = use_case_target_class
15
+ end
16
+
17
+ def data
18
+ @collection.map do |object|
19
+ SuccessPayload.new(@use_case_target_class.new(object)).data
20
+ end
21
+ end
22
+
23
+ def version
24
+ '1.0'
25
+ end
26
+ end
27
+ end
28
+ end
@@ -8,20 +8,21 @@ module CleanArchitecture
8
8
  class SuccessPayload
9
9
  implements_interface CleanArchitecture::Interfaces::SuccessPayload
10
10
 
11
- attr_reader :version
12
-
13
- def initialize(use_case_target, version)
11
+ def initialize(use_case_target)
14
12
  @use_case_target = use_case_target
15
- @version = version
16
13
  end
17
14
 
18
- def data_hash
15
+ def data
19
16
  {
20
17
  type: @use_case_target.type_name,
21
18
  id: @use_case_target.identifier,
22
19
  attributes: @use_case_target.attribute_hash
23
20
  }.compact
24
21
  end
22
+
23
+ def version
24
+ '1.0'
25
+ end
25
26
  end
26
27
  end
27
28
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CleanArchitecture
4
- VERSION = '1.2.0'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -0,0 +1,15 @@
1
+ { pkgs ? import <nixpkgs> {} }:
2
+
3
+ with pkgs;
4
+
5
+ let
6
+ ruby = pkgs.ruby_2_4;
7
+ bundler = pkgs.bundler.override { inherit ruby; };
8
+
9
+ in pkgs.stdenv.mkDerivation {
10
+ name = "cleanArchitectureEnv";
11
+ buildInputs = [
12
+ readline
13
+ ruby.devEnv
14
+ ];
15
+ }
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: 1.2.0
4
+ version: 2.0.0
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: 2018-10-25 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-matcher
@@ -171,9 +171,11 @@ files:
171
171
  - lib/clean_architecture/serializers/all.rb
172
172
  - lib/clean_architecture/serializers/html_response_from_result.rb
173
173
  - lib/clean_architecture/serializers/json_response_from_result.rb
174
+ - lib/clean_architecture/serializers/success_collection_payload.rb
174
175
  - lib/clean_architecture/serializers/success_payload.rb
175
176
  - lib/clean_architecture/types.rb
176
177
  - lib/clean_architecture/version.rb
178
+ - shell.nix
177
179
  homepage: https://bellroy.com
178
180
  licenses: []
179
181
  metadata: {}
@@ -193,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
195
  version: '0'
194
196
  requirements: []
195
197
  rubyforge_project:
196
- rubygems_version: 2.6.13
198
+ rubygems_version: 2.7.7
197
199
  signing_key:
198
200
  specification_version: 4
199
201
  summary: Bellroy Clean Architecture Framework