rails_application_service 0.6.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e47161deb51bec3466f37eb936845b0464f67d803962ebc65b5a88eb2b0d0770
4
- data.tar.gz: 5e42179ec517d0c2ef2779bc46b8fe9c7c000f8fe595466edee79186074ca9d5
3
+ metadata.gz: 4a6b7f0644b23fc57ff0d7219b7ae0040340365dba01fea27a93e5d675622200
4
+ data.tar.gz: 58743015a4952874518e175f2a7ecb1e0c88cfc0b3a160b5fd2925f6810c2c5f
5
5
  SHA512:
6
- metadata.gz: e45cf7ad68739ec61369f2c7aca8e8fbe9845f6fede5c663939eaf8dd68aba0c22c1a8cabd65423915a0976252e2269326f2ed8c9b0d391d5c8ddfc739bcc507
7
- data.tar.gz: afe771aeb70c7b7153ed2bb7d6872a9f4ce814bf3485d6dd6077d269d31717f4b2a7461311abada17538451f50376a8c155ef02ee2305044315d1f73856e6f88
6
+ metadata.gz: e33a5cebde38e7a49706f17e29aeee5b7e21f9edb67305debdd94c1e41b5f80a9c1f831aa80da97b0de52570c6a91c424507c47aa02208a8e070a11616b5a97e
7
+ data.tar.gz: 3abc11d67ab4929c77868e52f6d32e05f4092e16e106229bdd4a27a52f9df92c481c4199ba109301a17cd05a3840bc5e48a2fb56bdb247abbcfcce25694069b3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.1
1
+ 4.0.3
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project are documented in this file.
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.2] - in progress
9
+
10
+ ### Added
11
+
12
+ ### Changed
13
+ - Simplified docs
14
+
15
+ ### Removed
16
+
17
+ ### Breaking Changes
18
+
8
19
  ## [0.6.1] - 2025-06-18
9
20
 
10
21
  ### Added
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 Mário Marroquim
3
+ Copyright (c) 2026 Mário Marroquim
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rails Application Service
2
2
 
3
- Service objects for Rails, the Rails way. This Ruby gem adds service objects to your Rails applications.
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 service objects with robust type handling and validations. It leverages `ActiveModel::API` for initialization with keyword arguments, `ActiveModel::Attributes` for type casting, and `ActiveModel::Validations` for input validation.
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
- attribute :number_a, :integer
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
- ### Supported attribute types
63
-
64
- This gem supports the following attribute types through `ActiveModel::Attributes` and custom types defined in `ActiveModel::Type`:
57
+ ## Contributing
65
58
 
66
- - `:boolean`
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 repo, run `bin/setup` to install dependencies. Then, run `rake spec` to execute the tests. You can also run `bin/console` for an interactive prompt to experiment.
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 onto 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 will create a git tag for the version, push git commits and the tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApplicationService
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.3"
5
5
  end
@@ -8,16 +8,13 @@ require "active_model"
8
8
  # perform a single action or a series of related actions.
9
9
  module ApplicationService
10
10
  # The Base class within the ApplicationService module provides a standard
11
- # interface for calling service objects with robust type handling and validations.
12
- # It leverages ActiveModel::API for initialization with keyword arguments,
13
- # ActiveModel::Attributes for type casting, and ActiveModel::Validations for
14
- # input validation.
11
+ # interface for calling service objects. It leverages ActiveModel for
12
+ # initialization with keyword arguments and input validation.
15
13
  #
16
14
  # Example usage:
17
15
  #
18
16
  # class Sum < ApplicationService::Base
19
- # attribute :number_a, :integer
20
- # attribute :number_b, :integer
17
+ # attr_accessor :number_a, :number_b
21
18
  #
22
19
  # validates :number_a, :number_b, presence: true, numericality: { greater_than: 0 }
23
20
  #
@@ -27,22 +24,8 @@ module ApplicationService
27
24
  # end
28
25
  #
29
26
  # sum = Sum.call(number_a: 1, number_b: 2) # => 3
30
- #
31
- # This gem supports the following attribute types through ActiveModel::Attributes and
32
- # other custom types defined in ActiveModel::Type:
33
- #
34
- # - :boolean
35
- # - :date
36
- # - :datetime
37
- # - :decimal
38
- # - :float
39
- # - :integer
40
- # - :string
41
- # - :time
42
27
  class Base
43
- include ::ActiveModel::API
44
- include ::ActiveModel::Attributes
45
- include ::ActiveModel::Validations
28
+ include ::ActiveModel::Model
46
29
 
47
30
  # Initializes a new instance of the service object.
48
31
  #
@@ -51,9 +34,9 @@ module ApplicationService
51
34
  def initialize(**kwargs)
52
35
  super
53
36
 
54
- if instance_of?(Base)
55
- raise ::NotImplementedError, "#{self.class.name} is an abstract class and cannot be instantiated directly"
56
- end
37
+ return unless instance_of?(Base)
38
+
39
+ raise ::NotImplementedError, "#{self.class.name} is an abstract class and cannot be instantiated directly"
57
40
  end
58
41
 
59
42
  # Instantiates a new service object and invokes its `call` method.
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.1
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: 2025-06-18 00:00:00.000000000 Z
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 objects to Rails applications.
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: []
@@ -47,7 +48,7 @@ licenses:
47
48
  metadata:
48
49
  homepage_uri: https://github.com/mariomarroquim/rails_application_service
49
50
  changelog_uri: https://github.com/mariomarroquim/rails_application_service/CHANGELOG.md
50
- rubygems_mfa_required: 'false'
51
+ rubygems_mfa_required: 'true'
51
52
  rdoc_options: []
52
53
  require_paths:
53
54
  - lib
@@ -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: 3.6.6
66
+ rubygems_version: 4.0.11
66
67
  specification_version: 4
67
- summary: Service objects for Rails - the Rails way.
68
+ summary: Add service classes to Ruby on Rails web applications.
68
69
  test_files: []