use_cases 0.3.3 → 0.3.7

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: 77207afa5f5968912f856f321850ff0be1baca220af443e541f666a47ce73f53
4
- data.tar.gz: e57443d5a9e82500bf3174b8fa8962b1dc0dff8e2bb761eadb15412a7ce117be
3
+ metadata.gz: 880db7fc79e3ba760a30981fc8a4d35184e78ab25cc3e6dd2feee56ce0b108a1
4
+ data.tar.gz: cbc940544888cec9cb00d9e36d3808f6cc75be22cfb153d4d030fba36a62d74c
5
5
  SHA512:
6
- metadata.gz: 4f6e3bb967a99f4fe28e5e5d75310e31b595a6943845d225fc29e46bed0d292f1b18b2057bd0cd1e443a8af2615f78210ae3918a18dd2fd0c879510fb238711a
7
- data.tar.gz: d6981340c2c428f900071c605d712d06528cd463ff9c5271cd11f13a231e915b3dbf8944ac3fb737d8bcbd06d2fa4df3e80cc6fcd5ce49cae3f35fb455b38a97
6
+ metadata.gz: 9c91e8b8307a71c2c8d0bd4504dd6345a32d7e0520d1b7cc21c993bb57b64e5fda77c9ba8a18d56b295977052f8045b6dd42d33aab2adbbd4a49f9dd44cf1044
7
+ data.tar.gz: 42853537ccdda26d4c67c15ef621973a204102c1a31770b2ef5733da6d971fbda117e33cc1bbfd6dc044af1fe36ad6fd647db3640c1f3b2d83a132d8dcec8b9b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- use_cases (0.2.7)
4
+ use_cases (0.3.6)
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.
@@ -9,7 +9,7 @@ RSpec::Matchers.define(:be_failure_with_code) do |expected_code|
9
9
  end
10
10
 
11
11
  failure_message do |test_subject|
12
- if text_subject.failure?
12
+ if test_subject.failure?
13
13
  "the use case was expected to fail with code #{expected_code} but it returned #{test_subject.failure.first}"
14
14
  else
15
15
  "the use case was expected to fail with code #{expected_code} but it did not fail"
@@ -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.3"
4
+ VERSION = "0.3.7"
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.3
4
+ version: 0.3.7
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-11-24 00:00:00.000000000 Z
11
+ date: 2021-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport