rails_application_service 0.6.2 → 0.6.3
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 +4 -4
- data/.ruby-version +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +8 -30
- data/lib/application_service/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a6b7f0644b23fc57ff0d7219b7ae0040340365dba01fea27a93e5d675622200
|
|
4
|
+
data.tar.gz: 58743015a4952874518e175f2a7ecb1e0c88cfc0b3a160b5fd2925f6810c2c5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e33a5cebde38e7a49706f17e29aeee5b7e21f9edb67305debdd94c1e41b5f80a9c1f831aa80da97b0de52570c6a91c424507c47aa02208a8e070a11616b5a97e
|
|
7
|
+
data.tar.gz: 3abc11d67ab4929c77868e52f6d32e05f4092e16e106229bdd4a27a52f9df92c481c4199ba109301a17cd05a3840bc5e48a2fb56bdb247abbcfcce25694069b3
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.3
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rails Application Service
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This Ruby gem adds service classes (for example, use cases, features, or commands) to Ruby on Rails web applications.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -24,13 +24,11 @@ mkdir -p app/services
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
-
The `ApplicationService::Base` class provides a standard interface for calling
|
|
27
|
+
The `ApplicationService::Base` class provides a standard interface for calling services. It leverages `ActiveModel` for initialization with keyword arguments and input validation.
|
|
28
28
|
|
|
29
29
|
### Basic service example
|
|
30
30
|
|
|
31
31
|
```ruby
|
|
32
|
-
require "application_service"
|
|
33
|
-
|
|
34
32
|
class MyService < ApplicationService::Base
|
|
35
33
|
def call
|
|
36
34
|
# Perform the service action
|
|
@@ -43,11 +41,8 @@ my_service = MyService.call # nil
|
|
|
43
41
|
### Example with attributes and validations
|
|
44
42
|
|
|
45
43
|
```ruby
|
|
46
|
-
require "application_service"
|
|
47
|
-
|
|
48
44
|
class Sum < ApplicationService::Base
|
|
49
|
-
|
|
50
|
-
attribute :number_b, :integer
|
|
45
|
+
attr_accessor :number_a, :number_b
|
|
51
46
|
|
|
52
47
|
validates :number_a, :number_b, presence: true, numericality: { greater_than: 0 }
|
|
53
48
|
|
|
@@ -59,36 +54,19 @@ end
|
|
|
59
54
|
sum = Sum.call(number_a: 1, number_b: 2) # => 3
|
|
60
55
|
```
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
This gem supports the following attribute types through `ActiveModel::Attributes` and custom types defined in `ActiveModel::Type`:
|
|
57
|
+
## Contributing
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
- `:date`
|
|
68
|
-
- `:datetime`
|
|
69
|
-
- `:decimal`
|
|
70
|
-
- `:float`
|
|
71
|
-
- `:integer`
|
|
72
|
-
- `:string`
|
|
73
|
-
- `:time`
|
|
59
|
+
Bug reports and pull requests are welcome on GitHub: [mariomarroquim/rails_application_service](https://github.com/mariomarroquim/rails_application_service). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to follow the [Code of Conduct](https://github.com/mariomarroquim/rails_application_service/blob/main/CODE_OF_CONDUCT.md).
|
|
74
60
|
|
|
75
61
|
## Development
|
|
76
62
|
|
|
77
|
-
After checking out the
|
|
63
|
+
After checking out the repository, run `bin/setup` to install dependencies. Then run `rake spec` to execute the test suite. You can also run `bin/console` to open an interactive prompt for experimentation.
|
|
78
64
|
|
|
79
|
-
To install this gem
|
|
80
|
-
|
|
81
|
-
## Contributing
|
|
82
|
-
|
|
83
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/mariomarroquim/rails_application_service. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mariomarroquim/rails_application_service/blob/main/CODE_OF_CONDUCT.md).
|
|
65
|
+
To install this gem on your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, then run `bundle exec rake release`. This command creates a git tag for the version, pushes the commits and tag, and publishes the `.gem` file to [RubyGems.org](https://rubygems.org).
|
|
84
66
|
|
|
85
67
|
## License
|
|
86
68
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## Code of Conduct
|
|
90
|
-
|
|
91
|
-
Everyone interacting in the ApplicationService project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/mariomarroquim/rails_application_service/blob/main/CODE_OF_CONDUCT.md).
|
|
69
|
+
This gem is available as open source under the terms of the [MIT License](https://github.com/mariomarroquim/rails_application_service/blob/main/LICENSE.txt).
|
|
92
70
|
|
|
93
71
|
## Support
|
|
94
72
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_application_service
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mário Marroquim
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activemodel
|
|
@@ -23,7 +23,8 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '4.2'
|
|
26
|
-
description: This Ruby gem adds service
|
|
26
|
+
description: This Ruby gem adds service classes (e.g., use cases, features, or commands)
|
|
27
|
+
to Rails apps.
|
|
27
28
|
email:
|
|
28
29
|
- mariomarroquim@gmail.com
|
|
29
30
|
executables: []
|
|
@@ -62,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
63
|
- !ruby/object:Gem::Version
|
|
63
64
|
version: '0'
|
|
64
65
|
requirements: []
|
|
65
|
-
rubygems_version:
|
|
66
|
+
rubygems_version: 4.0.11
|
|
66
67
|
specification_version: 4
|
|
67
|
-
summary:
|
|
68
|
+
summary: Add service classes to Ruby on Rails web applications.
|
|
68
69
|
test_files: []
|