rest_my_case 1.1.0 → 1.2.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
2
  SHA1:
3
- metadata.gz: 24f1ea66d95ea0375eb3a27f226eacd76f615c18
4
- data.tar.gz: aaff479de083593b50440e49c84cf68e3911a2ec
3
+ metadata.gz: 1d0c344e572726b96515f59752258d4073b89937
4
+ data.tar.gz: aa11435140ce2d8f8b37092b8ad80700194114dc
5
5
  SHA512:
6
- metadata.gz: 0ee5095a6139908f84ebf44c9e1e665f84dc794a43d08432813cfec5aaedb7de233515f7e64a9eee482f15a5f28002aceb14cba0d39123316c183437903095af
7
- data.tar.gz: 0afb19fa366ac967335d80b7bcfe054b1deffaacfb064a00b296e7345d41f59bb7d239998bbb95506226c78ab43815aae0e040e88da7465d77eb8f59fec684d9
6
+ metadata.gz: 28dfb80a2170e238e2c1298887f3bf7c49b21ff0ea3f2ec99060ea937423cf4d45a79ef9a6aff3fb68eb83da1bdb7041270ec9298c0a71ef02a4b6936628b022
7
+ data.tar.gz: d18a6ace349f311fcf3ce082fd1bb6608593ccd9019d54ac3b3fc9010a45c8fe5cd80f279de2a3a84f831a319192cec7fb4dda2c9c48901744f46884300dde37
data/lib/rest_my_case.rb CHANGED
@@ -1,24 +1,24 @@
1
- require "rest_my_case/configuration"
1
+ require "rest_my_case/configuration/base"
2
2
  require "rest_my_case/version"
3
3
  require "rest_my_case/errors"
4
4
  require "rest_my_case/base"
5
5
 
6
6
  module RestMyCase
7
7
 
8
- def self.configure(&block)
9
- yield(Config)
8
+ def self.configure
9
+ yield config
10
10
  end
11
11
 
12
- def self.configure
13
- yield configuration
12
+ def self.config
13
+ @config ||= Configuration::Base.new
14
14
  end
15
15
 
16
- def self.configuration
17
- @configuration ||= Configuration.new
16
+ def self.reset_config
17
+ @config = Configuration::Base.new
18
18
  end
19
19
 
20
- def self.reset_configuration
21
- @configuration = Configuration.new
20
+ def self.get_config(attribute, use_case)
21
+ config.get(attribute, use_case)
22
22
  end
23
23
 
24
24
  end
@@ -1,9 +1,12 @@
1
+ require "rest_my_case/defense_attorney"
1
2
  require "rest_my_case/judges/base"
2
3
 
3
4
  module RestMyCase
4
5
 
5
6
  class Base
6
7
 
8
+ extend Configuration::Shared
9
+
7
10
  def self.depends(*use_cases)
8
11
  dependencies.push *use_cases
9
12
  end
@@ -13,11 +16,9 @@ module RestMyCase
13
16
  end
14
17
 
15
18
  def self.perform(attributes = {})
16
- unless attributes.respond_to?(:to_hash)
17
- raise ArgumentError.new('Must respond_to method #to_hash')
18
- end
19
+ new_trial_case = DefenseAttorney.new(self, attributes).build_trial_case
19
20
 
20
- Judges::Base.execute_the_sentence(self, attributes.to_hash)
21
+ Judges::Base.new(trial_case).execute_the_sentence
21
22
  end
22
23
 
23
24
  def self.context_accessor(*methods)
@@ -0,0 +1,24 @@
1
+ require "rest_my_case/configuration/shared"
2
+
3
+ module RestMyCase
4
+ module Configuration
5
+
6
+ class Base
7
+
8
+ include Shared
9
+
10
+ def initialize
11
+ @dependencies_first = true
12
+ @parent_dependencies_first = true
13
+ end
14
+
15
+ def get(attribute, use_case)
16
+ custom_config = use_case.send(attribute)
17
+
18
+ custom_config.nil? ? send(attribute) : custom_config
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ module RestMyCase
2
+ module Configuration
3
+
4
+ module Shared
5
+
6
+ attr_accessor :dependencies_first,
7
+ :parent_dependencies_first
8
+
9
+ end
10
+
11
+ end
12
+ end
@@ -2,31 +2,55 @@ require "rest_my_case/context"
2
2
 
3
3
  module RestMyCase
4
4
 
5
- module DefenseAttorney
5
+ class DefenseAttorney
6
6
 
7
- def self.build_use_cases_for_the(defendant, attributes)
8
- shared_context = Context.new attributes
7
+ def initialize(starting_point_use_case, attributes)
8
+ unless attributes.respond_to?(:to_hash)
9
+ raise ArgumentError.new('Must respond_to method #to_hash')
10
+ end
11
+
12
+ @shared_context = Context.new attributes.to_hash
13
+ @starting_point_use_case = starting_point_use_case
14
+ end
9
15
 
10
- dependencies(defendant).map do |use_case|
11
- use_case.new(shared_context)
16
+ def build_trial_case
17
+ all_dependencies(@starting_point_use_case).map do |use_case|
18
+ use_case.new(@shared_context)
12
19
  end
13
20
  end
14
21
 
15
- def self.dependencies(use_case)
22
+ protected ###################### PROTECTED #########################
23
+
24
+ def all_dependencies(use_case)
16
25
  return [] unless use_case.respond_to?(:dependencies)
17
26
 
18
- if parent_dependencies_first?(use_case)
19
- dependencies(use_case.superclass) | use_case.dependencies
27
+ if RestMyCase.get_config(:parent_dependencies_first, use_case)
28
+ all_dependencies(use_case.superclass) | deep_dependencies(use_case)
20
29
  else
21
- use_case.dependencies | dependencies(use_case.superclass)
30
+ deep_dependencies(use_case) | all_dependencies(use_case.superclass)
22
31
  end
23
32
  end
24
33
 
25
- protected ###################### PROTECTED #########################
34
+ def deep_dependencies(use_case)
35
+ deep_dependencies = []
36
+
37
+ use_case.dependencies.each do |use_case|
38
+ deep_dependencies.push *all_dependencies(use_case)
39
+ end
40
+
41
+ include_current_use_case(deep_dependencies, use_case)
42
+ end
43
+
44
+ private ####################### PRIVATE ###########################
26
45
 
27
- def self.parent_dependencies_first?(use_case)
28
- # use_case.parent_dependencies_first ||
29
- RestMyCase.configuration.parent_dependencies_first
46
+ def include_current_use_case(dependencies, use_case)
47
+ return dependencies unless use_case.superclass.respond_to?(:dependencies)
48
+
49
+ if RestMyCase.get_config(:dependencies_first, use_case)
50
+ dependencies.push(use_case)
51
+ else
52
+ dependencies.unshift(use_case)
53
+ end
30
54
  end
31
55
 
32
56
  end
@@ -1,27 +1,21 @@
1
- require "rest_my_case/defense_attorney"
2
-
3
1
  module RestMyCase
4
2
  module Judges
5
3
 
6
4
  class Base
7
5
 
8
- def self.execute_the_sentence(defendant, attributes)
9
- new_trial = self.new(defendant, attributes)
10
-
11
- new_trial.run_setup_methods
12
- new_trial.run_perform_methods
13
- new_trial.run_rollback_methods
14
- new_trial.run_final_methods
15
- end
16
-
17
- def initialize(defendant, attributes)
18
- @use_cases =
19
- DefenseAttorney.build_use_cases_for_the(defendant, attributes)
20
-
6
+ def initialize(use_cases)
7
+ @use_cases = use_cases
21
8
  @performed_use_cases = []
22
9
  @use_case_that_aborted = false
23
10
  end
24
11
 
12
+ def execute_the_sentence
13
+ run_setup_methods
14
+ run_perform_methods
15
+ run_rollback_methods
16
+ run_final_methods
17
+ end
18
+
25
19
  protected #################### PROTECTED ####################
26
20
 
27
21
  def run_setup_methods
@@ -1,3 +1,5 @@
1
1
  module RestMyCase
2
- VERSION = "1.1.0"
2
+
3
+ VERSION = "1.2.0"
4
+
3
5
  end
@@ -2,27 +2,38 @@ require 'spec_helper'
2
2
 
3
3
  describe RestMyCase::Base do
4
4
 
5
- context "When a use case depends on other use cases" do
6
-
7
- it ".dependencies should list the class's dependencies" do
8
- expect(Posts::Create::Base.dependencies).to \
9
- eq [Posts::Create::BuildPost, Posts::SavePost]
5
+ module RestMyCaseBase
6
+ class LogEvents < RestMyCase::Base; end
7
+ class AnalyseEvents < RestMyCase::Base; end
8
+ class BuildPost < RestMyCase::Base; end
9
+ class SavePost < RestMyCase::Base; end
10
+ class BuildComments < RestMyCase::Base; end
11
+ class SaveComments < RestMyCase::Base; end
12
+
13
+ class UseCaseWrapper < RestMyCase::Base
14
+ context_writer :id
15
+ context_reader :session
16
+ context_accessor :comment
17
+ depends LogEvents, AnalyseEvents
18
+ end
19
+ class CreatePost < UseCaseWrapper
20
+ depends BuildPost, SavePost
21
+ end
22
+ class CreatePostWithComments < CreatePost
23
+ depends BuildComments, SaveComments
10
24
  end
11
-
12
25
  end
13
26
 
14
- context "When a use case inherits from another that also has its own dependencies" do
15
-
16
- it ".dependencies should only list the class's dependencies" do
17
- expect(Comments::Create::SendEmail.dependencies).to eq [Comments::FindOne]
27
+ describe ".dependencies" do
28
+ it " should only list the class's dependencies" do
29
+ expect(RestMyCaseBase::CreatePostWithComments.dependencies).to \
30
+ eq [RestMyCaseBase::BuildComments, RestMyCaseBase::SaveComments]
18
31
  end
19
-
20
32
  end
21
33
 
22
34
  describe ".context_accessor" do
23
-
24
35
  let(:context) { RestMyCase::Context.new(id: 1, comment: 'my comment', session: -1) }
25
- let(:use_case) { Comments::FindOne.new(context) }
36
+ let(:use_case) { RestMyCaseBase::CreatePostWithComments.new(context) }
26
37
 
27
38
  it "Should create getters targeting to context" do
28
39
  expect(use_case.respond_to?(:comment)).to be true
@@ -40,12 +51,10 @@ describe RestMyCase::Base do
40
51
  use_case.comment = 'your comment'
41
52
  expect(use_case.context.comment).to eq 'your comment'
42
53
  end
43
-
44
54
  end
45
55
 
46
56
  describe ".context_writer" do
47
-
48
- let(:use_case) { Comments::FindOne.new(RestMyCase::Context.new) }
57
+ let(:use_case) { RestMyCaseBase::CreatePostWithComments.new(RestMyCase::Context.new) }
49
58
 
50
59
  it "Should create setters targeting to context" do
51
60
  expect(use_case.respond_to?(:id)).to be false
@@ -57,13 +66,11 @@ describe RestMyCase::Base do
57
66
 
58
67
  expect(use_case.context.id).to eq 2
59
68
  end
60
-
61
69
  end
62
70
 
63
71
  describe ".context_reader" do
64
-
65
72
  let(:context) { RestMyCase::Context.new(id: 1, comment: 'my comment', session: -1) }
66
- let(:use_case) { Comments::FindOne.new(context) }
73
+ let(:use_case) { RestMyCaseBase::CreatePostWithComments.new(context) }
67
74
 
68
75
  it "Should create getters targeting to context" do
69
76
  expect(use_case.respond_to?(:session)).to be true
@@ -73,7 +80,6 @@ describe RestMyCase::Base do
73
80
  it "Getter should delegate to context" do
74
81
  expect(use_case.session).to eq context.session
75
82
  end
76
-
77
83
  end
78
84
 
79
85
  end
@@ -2,33 +2,176 @@ require 'spec_helper'
2
2
 
3
3
  describe RestMyCase::DefenseAttorney do
4
4
 
5
- describe ".dependencies" do
5
+ module DefenseAttorney
6
+ class BuilEvent < RestMyCase::Base; end
7
+ class SaveEvent < RestMyCase::Base; end
8
+ class CreateEvent < RestMyCase::Base
9
+ depends SaveEvent
10
+ end
11
+ class LogEvents < RestMyCase::Base
12
+ depends BuilEvent, CreateEvent
13
+ end
14
+ class AnalyseEvents < RestMyCase::Base; end
15
+ class BuildPost < RestMyCase::Base; end
16
+ class SavePost < RestMyCase::Base; end
17
+ class BuildComments < RestMyCase::Base; end
18
+ class SaveComments < RestMyCase::Base; end
19
+ class CreateComments < RestMyCase::Base
20
+ depends SaveComments
21
+ end
6
22
 
7
- context "When a use case depends on other use cases" do
23
+ class UseCaseWrapper < RestMyCase::Base
24
+ depends LogEvents, AnalyseEvents
25
+ end
26
+ class CreatePost < UseCaseWrapper
27
+ depends BuildPost, SavePost
28
+ end
29
+ class CreatePostWithComments < CreatePost
30
+ depends BuildComments, CreateComments
31
+ end
32
+ end
8
33
 
9
- let(:use_cases) do
10
- RestMyCase::DefenseAttorney.dependencies Posts::Create::Base
34
+ shared_examples "a porper shepherd" do |dependencies|
35
+ it "use_cases should be in the proper order" do
36
+ dependencies.each_with_index do |dependency, index|
37
+ expect(use_cases[index]).to be_a dependency
11
38
  end
39
+ end
12
40
 
13
- it "use_cases should be in the proper order" do
14
- expect(use_cases).to eq [Posts::Create::BuildPost, Posts::SavePost]
41
+ it "use_cases should share the same context" do
42
+ use_cases.each do |use_case1|
43
+ use_cases.each do |use_case2|
44
+ expect(use_case1.context).to be use_case2.context
45
+ end
15
46
  end
47
+ end
48
+ end
49
+
50
+ context "When a use case depends on other use cases" do
51
+ let(:use_cases) do
52
+ described_class.new(DefenseAttorney::UseCaseWrapper, id: 1).build_trial_case
53
+ end
16
54
 
55
+ it_behaves_like "a porper shepherd", [
56
+ DefenseAttorney::BuilEvent,
57
+ DefenseAttorney::SaveEvent,
58
+ DefenseAttorney::CreateEvent,
59
+ DefenseAttorney::LogEvents,
60
+ DefenseAttorney::AnalyseEvents,
61
+ DefenseAttorney::UseCaseWrapper
62
+ ]
63
+ end
64
+
65
+ context "When a use case inherits from another that also has its own dependencies" do
66
+ let(:use_cases) do
67
+ described_class.new(DefenseAttorney::CreatePostWithComments, id: 1).build_trial_case
17
68
  end
18
69
 
19
- context "When a use case depends on other use cases" do
70
+ it_behaves_like "a porper shepherd", [
71
+ DefenseAttorney::BuilEvent,
72
+ DefenseAttorney::SaveEvent,
73
+ DefenseAttorney::CreateEvent,
74
+ DefenseAttorney::LogEvents,
75
+ DefenseAttorney::AnalyseEvents,
76
+ DefenseAttorney::UseCaseWrapper,
77
+ DefenseAttorney::BuildPost,
78
+ DefenseAttorney::SavePost,
79
+ DefenseAttorney::CreatePost,
80
+ DefenseAttorney::BuildComments,
81
+ DefenseAttorney::SaveComments,
82
+ DefenseAttorney::CreateComments,
83
+ DefenseAttorney::CreatePostWithComments
84
+ ]
85
+ end
20
86
 
21
- let(:use_cases) do
22
- RestMyCase::DefenseAttorney.dependencies Comments::Create::SendEmail
87
+ context "When general configuration has parent_dependencies_first = false" do
88
+ before do
89
+ RestMyCase.configure do |config|
90
+ config.parent_dependencies_first = false
23
91
  end
92
+ end
24
93
 
25
- it "use_cases should be in the proper order" do
26
- expect(use_cases).to \
27
- eq [Comments::FindOne, SendEmail::ToAdmins, SendEmail::ToUser, SendEmail::OneMoreDependency]
94
+ after { RestMyCase.reset_config }
95
+
96
+ let(:use_cases) do
97
+ described_class.new(DefenseAttorney::CreatePostWithComments, id: 1).build_trial_case
98
+ end
99
+
100
+ it_behaves_like "a porper shepherd", [
101
+ DefenseAttorney::BuildComments,
102
+ DefenseAttorney::SaveComments,
103
+ DefenseAttorney::CreateComments,
104
+ DefenseAttorney::CreatePostWithComments,
105
+
106
+ DefenseAttorney::BuildPost,
107
+ DefenseAttorney::SavePost,
108
+ DefenseAttorney::CreatePost,
109
+
110
+ DefenseAttorney::BuilEvent,
111
+ DefenseAttorney::SaveEvent,
112
+ DefenseAttorney::CreateEvent,
113
+ DefenseAttorney::LogEvents,
114
+ DefenseAttorney::AnalyseEvents,
115
+ DefenseAttorney::UseCaseWrapper
116
+ ]
117
+ end
118
+
119
+ context "When general configuration has dependencies_first = false" do
120
+ before do
121
+ RestMyCase.configure do |config|
122
+ config.dependencies_first = false
28
123
  end
124
+ end
125
+
126
+ after { RestMyCase.reset_config }
127
+
128
+ let(:use_cases) do
129
+ described_class.new(DefenseAttorney::CreatePostWithComments, id: 1).build_trial_case
130
+ end
131
+
132
+ it_behaves_like "a porper shepherd", [
133
+ DefenseAttorney::UseCaseWrapper,
134
+ DefenseAttorney::LogEvents,
135
+ DefenseAttorney::BuilEvent,
136
+ DefenseAttorney::CreateEvent,
137
+ DefenseAttorney::SaveEvent,
138
+ DefenseAttorney::AnalyseEvents,
139
+ DefenseAttorney::CreatePost,
140
+ DefenseAttorney::BuildPost,
141
+ DefenseAttorney::SavePost,
142
+ DefenseAttorney::CreatePostWithComments,
143
+ DefenseAttorney::BuildComments,
144
+ DefenseAttorney::CreateComments,
145
+ DefenseAttorney::SaveComments
146
+ ]
147
+ end
148
+
149
+ context "When an use case class configuration has dependencies_first = false" do
150
+ before do
151
+ DefenseAttorney::UseCaseWrapper.dependencies_first = false
152
+ end
153
+
154
+ after { DefenseAttorney::UseCaseWrapper.dependencies_first = nil }
29
155
 
156
+ let(:use_cases) do
157
+ described_class.new(DefenseAttorney::CreatePostWithComments, id: 1).build_trial_case
30
158
  end
31
159
 
160
+ it_behaves_like "a porper shepherd", [
161
+ DefenseAttorney::UseCaseWrapper,
162
+ DefenseAttorney::BuilEvent,
163
+ DefenseAttorney::SaveEvent,
164
+ DefenseAttorney::CreateEvent,
165
+ DefenseAttorney::LogEvents,
166
+ DefenseAttorney::AnalyseEvents,
167
+ DefenseAttorney::BuildPost,
168
+ DefenseAttorney::SavePost,
169
+ DefenseAttorney::CreatePost,
170
+ DefenseAttorney::BuildComments,
171
+ DefenseAttorney::SaveComments,
172
+ DefenseAttorney::CreateComments,
173
+ DefenseAttorney::CreatePostWithComments
174
+ ]
32
175
  end
33
176
 
34
177
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_my_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - goncalvesjoao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -83,7 +83,8 @@ files:
83
83
  - Rakefile
84
84
  - lib/rest_my_case.rb
85
85
  - lib/rest_my_case/base.rb
86
- - lib/rest_my_case/configuration.rb
86
+ - lib/rest_my_case/configuration/base.rb
87
+ - lib/rest_my_case/configuration/shared.rb
87
88
  - lib/rest_my_case/context.rb
88
89
  - lib/rest_my_case/defense_attorney.rb
89
90
  - lib/rest_my_case/errors.rb
@@ -94,22 +95,6 @@ files:
94
95
  - spec/rest_my_case/defense_attorney_spec.rb
95
96
  - spec/rest_my_case/judges/base_spec.rb
96
97
  - spec/spec_helper.rb
97
- - spec/support/_send_email/base.rb
98
- - spec/support/_send_email/fetch_admins.rb
99
- - spec/support/_send_email/one_more_dependency.rb
100
- - spec/support/_send_email/to_admins.rb
101
- - spec/support/_send_email/to_user.rb
102
- - spec/support/_send_email/use_case.rb
103
- - spec/support/comments/create/base.rb
104
- - spec/support/comments/create/build_comment.rb
105
- - spec/support/comments/create/send_email.rb
106
- - spec/support/comments/find_one.rb
107
- - spec/support/comments/save_comment.rb
108
- - spec/support/comments/use_case.rb
109
- - spec/support/posts/create/base.rb
110
- - spec/support/posts/create/build_post.rb
111
- - spec/support/posts/save_post.rb
112
- - spec/support/posts/use_case.rb
113
98
  homepage: https://github.com/goncalvesjoao/rest_my_case
114
99
  licenses:
115
100
  - MIT
@@ -139,19 +124,3 @@ test_files:
139
124
  - spec/rest_my_case/defense_attorney_spec.rb
140
125
  - spec/rest_my_case/judges/base_spec.rb
141
126
  - spec/spec_helper.rb
142
- - spec/support/_send_email/base.rb
143
- - spec/support/_send_email/fetch_admins.rb
144
- - spec/support/_send_email/one_more_dependency.rb
145
- - spec/support/_send_email/to_admins.rb
146
- - spec/support/_send_email/to_user.rb
147
- - spec/support/_send_email/use_case.rb
148
- - spec/support/comments/create/base.rb
149
- - spec/support/comments/create/build_comment.rb
150
- - spec/support/comments/create/send_email.rb
151
- - spec/support/comments/find_one.rb
152
- - spec/support/comments/save_comment.rb
153
- - spec/support/comments/use_case.rb
154
- - spec/support/posts/create/base.rb
155
- - spec/support/posts/create/build_post.rb
156
- - spec/support/posts/save_post.rb
157
- - spec/support/posts/use_case.rb
@@ -1,13 +0,0 @@
1
- module RestMyCase
2
-
3
- class Configuration
4
-
5
- attr_accessor :parent_dependencies_first
6
-
7
- def initialize
8
- @parent_dependencies_first = false
9
- end
10
-
11
- end
12
-
13
- end
@@ -1,14 +0,0 @@
1
- require_relative 'use_case'
2
- require_relative 'to_admins'
3
- require_relative 'to_user'
4
-
5
- module SendEmail
6
-
7
- class Base < UseCase
8
-
9
- depends ToAdmins,
10
- ToUser
11
-
12
- end
13
-
14
- end
@@ -1,6 +0,0 @@
1
- module SendEmail
2
-
3
- class FetchAdmins < RestMyCase::Base
4
- end
5
-
6
- end
@@ -1,6 +0,0 @@
1
- module SendEmail
2
-
3
- class OneMoreDependency < RestMyCase::Base
4
- end
5
-
6
- end
@@ -1,11 +0,0 @@
1
- require_relative 'fetch_admins'
2
-
3
- module SendEmail
4
-
5
- class ToAdmins < RestMyCase::Base
6
-
7
- depends FetchAdmins
8
-
9
- end
10
-
11
- end
@@ -1,6 +0,0 @@
1
- module SendEmail
2
-
3
- class ToUser < RestMyCase::Base
4
- end
5
-
6
- end
@@ -1,11 +0,0 @@
1
- require_relative 'one_more_dependency'
2
-
3
- module SendEmail
4
-
5
- class UseCase < RestMyCase::Base
6
-
7
- depends OneMoreDependency
8
-
9
- end
10
-
11
- end
@@ -1,18 +0,0 @@
1
- require_relative '../use_case'
2
- require_relative 'build_comment'
3
- require_relative 'send_email'
4
- require_relative '../save_comment'
5
-
6
- module Comments
7
- module Create
8
-
9
- class Base < UseCase
10
-
11
- depends BuildComment,
12
- SaveComment,
13
- SendEmail
14
-
15
- end
16
-
17
- end
18
- end
@@ -1,8 +0,0 @@
1
- module Comments
2
- module Create
3
-
4
- class BuildComment < UseCase
5
- end
6
-
7
- end
8
- end
@@ -1,13 +0,0 @@
1
- require_relative '../find_one'
2
-
3
- module Comments
4
- module Create
5
-
6
- class SendEmail < ::SendEmail::Base
7
-
8
- depends FindOne
9
-
10
- end
11
-
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- require_relative 'use_case'
2
-
3
- module Comments
4
-
5
- class FindOne < UseCase
6
- end
7
-
8
- end
@@ -1,6 +0,0 @@
1
- module Comments
2
-
3
- class SaveComment < UseCase
4
- end
5
-
6
- end
@@ -1,11 +0,0 @@
1
- module Comments
2
-
3
- class UseCase < RestMyCase::Base
4
-
5
- context_writer :id
6
- context_reader :session
7
- context_accessor :comment
8
-
9
- end
10
-
11
- end
@@ -1,16 +0,0 @@
1
- require_relative '../use_case'
2
- require_relative 'build_post'
3
- require_relative '../save_post'
4
-
5
- module Posts
6
- module Create
7
-
8
- class Base < UseCase
9
-
10
- depends BuildPost,
11
- SavePost
12
-
13
- end
14
-
15
- end
16
- end
@@ -1,8 +0,0 @@
1
- module Posts
2
- module Create
3
-
4
- class BuildPost < UseCase
5
- end
6
-
7
- end
8
- end
@@ -1,6 +0,0 @@
1
- module Posts
2
-
3
- class SavePost < UseCase
4
- end
5
-
6
- end
@@ -1,6 +0,0 @@
1
- module Posts
2
-
3
- class UseCase < RestMyCase::Base
4
- end
5
-
6
- end