use_cases 0.3.2 → 0.3.6

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
  SHA256:
3
- metadata.gz: 86bb76e93659c9a0512a573bb45ea5c1a4c905bcbbf8df35c6144f687c4f75d0
4
- data.tar.gz: b52e54fd5535dc623f1627f38afd6904448bbe01cd6a5c77570c456e15aa105e
3
+ metadata.gz: f8e525e5eca2560cc730e11642da2fa1147755cddc3cf880a0f978648343cc65
4
+ data.tar.gz: 5549575e2461f3b1790b703eaa7f082969307b0ef619f31f3b361e038df1858d
5
5
  SHA512:
6
- metadata.gz: f359f8ceddc2bc4de7379565e3e69ac0444f85d343e17d9b80d8fb7665db575f963a7dcd57df0e6be37e0b718e61c142e1661f07b917b580a6c9b192f16d58b6
7
- data.tar.gz: d2085d518a685ea7d3edb1491cb629f691f33d8e9e637ddc3adf463b6f997263cf08b5bc8b307e960a2dc59abf2b8b3cb2a96c0c12d0cfe131fe9d89549d484e
6
+ metadata.gz: 4e3854dd7bedebe7704c256e388338ac760b68544d34207a7cad61ab18c4b6de6171bf068ffaaa9685c57bf3ea5df9389def5fc6e462026912c19283ebc9fab6
7
+ data.tar.gz: 192775fcb2524dbf7d097f2c12ef083816b8d161f2b97deacaa23a3194e9eb9b4e4c5c237c39ddae633c063f9e26e7c196b2e23d3a681cf9982ad9184a825ef1
data/.gitignore CHANGED
@@ -9,4 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- .byebug_history
12
+ .byebug_history
13
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- use_cases (0.2.5)
4
+ use_cases (0.3.5)
5
5
  activesupport
6
6
  dry-events
7
7
  dry-matcher
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  # UseCases
6
6
 
7
+ ## Currently Unstable! Use at your own risk.
8
+
7
9
  `UseCases` is a gem based on the [dry-transaction](https://dry-rb.org/gems/dry-transaction/) DSL that implements macros commonly used internally by Ring Twice.
8
10
 
9
11
  `UseCases` does not however use `dry-transaction` behind the scenes. Instead it relies on other `dry` libraries like [dry-validation](https://dry-rb.org/gems/dry-validation/), [dry-events](https://dry-rb.org/gems/dry-validation/) and [dry-monads](https://dry-rb.org/gems/dry-validation/) to implement a DSL that can be flexible enough for our needs.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "byebug"
4
-
5
3
  module UseCases
6
4
  module Notifications
7
5
  def self.included(base)
@@ -55,13 +55,13 @@ module UseCases
55
55
  end
56
56
 
57
57
  def callable_proc
58
- callable_object.method(callable_method)
58
+ callable_object.method(callable_method).to_proc
59
59
  end
60
60
 
61
61
  def callable_object
62
62
  case options[:with]
63
63
  when NilClass, FalseClass then object
64
- when String then object.send(options[:with])
64
+ when String, Symbol then object.send(options[:with])
65
65
  else options[:with]
66
66
  end
67
67
  end
@@ -12,8 +12,8 @@ module UseCases
12
12
  prev_result = previous_step_result.value
13
13
  raise InvalidReturnValue, "The return value should not be a Monad." if result.is_a?(Dry::Monads::Result)
14
14
 
15
- failure_code = options[:failure] || :check_failure
16
- failure_message = options[:failure_message] || "Failed"
15
+ failure_code = options[:failure] || :unauthorized
16
+ failure_message = options[:failure_message] || "Not Authorized"
17
17
 
18
18
  result ? Success(prev_result) : Failure([failure_code, failure_message])
19
19
  end
@@ -6,7 +6,7 @@ module UseCases
6
6
  def do_call(*base_args)
7
7
  args = [object.class.name, name.to_s, *base_args]
8
8
  args = ::UseCases::StepActiveJobAdapter.serialize_step_arguments(args)
9
- byebug
9
+
10
10
  job_options = options.slice(:queue, :wait, :wait_until, :priority)
11
11
 
12
12
  ::UseCases::StepActiveJobAdapter.set(job_options).perform_later(*args)
@@ -13,7 +13,7 @@ module UseCases
13
13
 
14
14
  Success(result)
15
15
  rescue options[:catch] || StandardError => e
16
- Failure([options[:failure], e.message])
16
+ Failure([options[:failure], options[:failure_message] || e.message])
17
17
  end
18
18
  end
19
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UseCases
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.6"
5
5
  end
data/lib/use_cases.rb CHANGED
@@ -4,4 +4,8 @@ require_relative "use_case"
4
4
  require_relative "use_cases/version"
5
5
  require_relative "use_cases/base"
6
6
 
7
- module UseCases; end
7
+ module UseCases
8
+ def self.register_type(type_name, klass)
9
+
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_cases
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ring Twice
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2021-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport