eztek-mediat_r 1.0.3 → 1.1.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -5
  3. data/lib/ez/mediat_r/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70e8616aa317335bb98b389dfb36643cf91709a1f2c1b34bf339b3eff13d85e1
4
- data.tar.gz: d8e6d3c5f1aa4b8f9f03491ab7e944ef1adf8f801f4ebc714fa271c17176ea21
3
+ metadata.gz: 81fe49ca3fee1be65127f9c763d31fd0da477737b0a2d016c5e8efb1a9712f7d
4
+ data.tar.gz: a71cb6498c253234c65e32f5a5df4eeadc313e89c5f81ee461369f7039783eeb
5
5
  SHA512:
6
- metadata.gz: 43150555a3c18fa15a3b15d77f3fbee7493c17a2a3353e2e6ab3c2e0fcd7a862c321b53a9413bc9a4f369a74f52bd23d96ec68637c346407cba20bb46f73ac1d
7
- data.tar.gz: b28f43ec9bba0f46f3345d2acb07dd1665cafbf2b844cd6abcffb32f6d27ccd1d7356cd8bedd7a246802032e2b6727bf2acf8eb0916d9e18445c50b39bbbfd85
6
+ metadata.gz: a9be31068ed497359eaf3278955420ed1231d35c5dde06fdb0dd7c325257dff1795a28912bf07b8b69e882d382584508909d4ab224961b446516be98de8f7cc9
7
+ data.tar.gz: e0b8646e6be3ea108701125521f1ed4c7f485211ce8d5c4e42bbb23961d727dddc7b0a04bffcb936b70463a74a3724235cbf1db6df6316d23f7b5accae914313
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Eztek::MediatR
1
+ # Eztek MediatR
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/eztek/mediat_r`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ <a href="https://www.buymeacoffee.com/phunguyen" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/eztek/mediat_r`. To experiment with that code, run `bin/console` for an interactive prompt.
6
6
 
7
7
  ## Installation
8
8
 
@@ -21,8 +21,55 @@ Or install it yourself as:
21
21
  $ gem install eztek-mediat_r
22
22
 
23
23
  ## Usage
24
+ ### Initialize mediatR
25
+ Add new file config/initializers/mediat_r.rb to initializer mediatR
26
+ ```ruby
27
+ require 'ez/mediat_r'
28
+
29
+ mediator = EZ::MediatR.new
30
+ Rails.configuration.to_prepare do
31
+ Rails.configuration.bus = Bus.new
32
+ Rails.configuration.bus.tap do |bus|
33
+ # Register command - handler
34
+ bus.register(Auth::Commands::LoginCommand, Auth::Commands::Handlers::LoginCommandHandler.new)
35
+ end
36
+ end
37
+
38
+ ```
39
+
40
+ ### Declare mediatR in controller
41
+ ```ruby
42
+ def initialize
43
+ @mediator = Rails.configuration.bus
44
+ end
45
+
46
+ ```
47
+
48
+ or dependency with dry-container, dry-auto_inject:
49
+
50
+ ### Register mediaR in container
51
+ Use file dependency.rb to register mediatR
52
+ ```ruby
53
+ require 'ez/mediat_r'
54
+
55
+ dependency_container = Dry::Container.new
56
+ dependency_container.register('mediator', -> { EZ::MediatR.new })
57
+ AutoInject = Dry::AutoInject(dependency_container)
58
+
59
+ ```
60
+
61
+ ### Define mediatR in controller
62
+ ```ruby
63
+ include AutoInject['mediator']
24
64
 
25
- TODO: Write usage instructions here
65
+ ```
66
+
67
+ ### Run mediator
68
+ ```ruby
69
+ command = Auth::Commands::LoginCommand.new(username, password)
70
+ mediator.execute(command)
71
+
72
+ ```
26
73
 
27
74
  ## Development
28
75
 
@@ -32,4 +79,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
79
 
33
80
  ## Contributing
34
81
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/eztek-mediat_r.
82
+ Bug reports and pull requests are welcome on GitHub at https://github.com/yeucon02vn/eztek-mediat_r.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module EZ
4
4
  module MediatR
5
- VERSION = "1.0.3"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eztek-mediat_r
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yeucon02vn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-08 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby