active_interaction 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +12 -12
- data/lib/active_interaction.rb +2 -2
- data/lib/active_interaction/version.rb +1 -1
- data/spec/active_interaction/i18n_spec.rb +10 -0
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3886f47131ea3b818d3c1aac281179e65975a76
|
4
|
+
data.tar.gz: adef81de6b569a05c85e4ffd59f2389836c1b5f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24989fa80ee14abcc56ddaa2b1c52c2c35286685d0fd27db0accc282581e598064e88cfb4898484a93327d23ebae246c50d415e4793a561d83f3b0e437bba808
|
7
|
+
data.tar.gz: cb5b99e7bd5eca69ccfc75583edcc58a45ef5fa5b08340f17c0b52b5e0f3e6457839784e85c291e506ac154f7367e609917869697bc109684c971e0f62d818e6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# [Master][]
|
2
2
|
|
3
|
+
# [1.4.1][] (2014-12-12)
|
4
|
+
|
5
|
+
## Fixed
|
6
|
+
|
7
|
+
- [#244][]: Fix improperly adding load paths to I18n.
|
8
|
+
|
3
9
|
# [1.4.0][] (2014-12-10)
|
4
10
|
|
5
11
|
## Changed
|
@@ -360,7 +366,8 @@
|
|
360
366
|
|
361
367
|
- Initial release.
|
362
368
|
|
363
|
-
[master]: https://github.com/orgsync/active_interaction/compare/v1.4.
|
369
|
+
[master]: https://github.com/orgsync/active_interaction/compare/v1.4.1...master
|
370
|
+
[1.4.1]: https://github.com/orgsync/active_interaction/compare/v1.4.0...v1.4.1
|
364
371
|
[1.4.0]: https://github.com/orgsync/active_interaction/compare/v1.3.1...v1.4.0
|
365
372
|
[1.3.1]: https://github.com/orgsync/active_interaction/compare/v1.3.0...v1.3.1
|
366
373
|
[1.3.0]: https://github.com/orgsync/active_interaction/compare/v1.2.5...v1.3.0
|
@@ -474,3 +481,4 @@
|
|
474
481
|
[#224]: https://github.com/orgsync/active_interaction/issues/224
|
475
482
|
[#235]: https://github.com/orgsync/active_interaction/issues/235
|
476
483
|
[#239]: https://github.com/orgsync/active_interaction/issues/239
|
484
|
+
[#244]: https://github.com/orgsync/active_interaction/issues/244
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ it will call `execute`, store the return value of that method in
|
|
49
49
|
`result`, and return an instance of your ActiveInteraction::Base
|
50
50
|
subclass. Let's look at a simple example:
|
51
51
|
|
52
|
-
```ruby
|
52
|
+
``` ruby
|
53
53
|
# Define an interaction that signs up a user.
|
54
54
|
class UserSignup < ActiveInteraction::Base
|
55
55
|
# required
|
@@ -103,7 +103,7 @@ ActiveRecord is available.
|
|
103
103
|
There are two way to call an interaction. Given UserSignup, you can
|
104
104
|
do this:
|
105
105
|
|
106
|
-
```ruby
|
106
|
+
``` ruby
|
107
107
|
outcome = UserSignup.run(params)
|
108
108
|
if outcome.valid?
|
109
109
|
# Do something with outcome.result...
|
@@ -114,7 +114,7 @@ end
|
|
114
114
|
|
115
115
|
Or, you can do this:
|
116
116
|
|
117
|
-
```ruby
|
117
|
+
``` ruby
|
118
118
|
result = UserSignup.run!(params)
|
119
119
|
# Either returns the result of execute,
|
120
120
|
# or raises ActiveInteraction::InvalidInteractionError
|
@@ -124,7 +124,7 @@ result = UserSignup.run!(params)
|
|
124
124
|
|
125
125
|
Interactions only accept a Hash for `run` and `run!`.
|
126
126
|
|
127
|
-
```ruby
|
127
|
+
``` ruby
|
128
128
|
# A user comments on an article
|
129
129
|
class CreateComment < ActiveInteraction::Base
|
130
130
|
model :article, :user
|
@@ -148,7 +148,7 @@ end
|
|
148
148
|
|
149
149
|
1. Subclass ActiveInteraction::Base
|
150
150
|
|
151
|
-
```ruby
|
151
|
+
``` ruby
|
152
152
|
class YourInteraction < ActiveInteraction::Base
|
153
153
|
# ...
|
154
154
|
end
|
@@ -156,7 +156,7 @@ end
|
|
156
156
|
|
157
157
|
2. Define your attributes:
|
158
158
|
|
159
|
-
```ruby
|
159
|
+
``` ruby
|
160
160
|
string :name, :state
|
161
161
|
integer :age
|
162
162
|
boolean :is_special
|
@@ -174,7 +174,7 @@ end
|
|
174
174
|
|
175
175
|
3. Use any additional validations you need:
|
176
176
|
|
177
|
-
```ruby
|
177
|
+
``` ruby
|
178
178
|
validates :name, length: { maximum: 10 }
|
179
179
|
validates :state, inclusion: { in: %w(AL AK AR ... WY) }
|
180
180
|
validate :arrives_before_departs
|
@@ -190,7 +190,7 @@ end
|
|
190
190
|
|
191
191
|
4. Define your execute method. It can return whatever you like:
|
192
192
|
|
193
|
-
```ruby
|
193
|
+
``` ruby
|
194
194
|
def execute
|
195
195
|
record = do_thing(...)
|
196
196
|
# ...
|
@@ -207,7 +207,7 @@ If the interaction is successful, it'll return the result (just like if you had
|
|
207
207
|
called it with `run!`). If something went wrong, execution will halt
|
208
208
|
immediately and the errors will be moved onto the caller.
|
209
209
|
|
210
|
-
```ruby
|
210
|
+
``` ruby
|
211
211
|
class AddThree < ActiveInteraction::Base
|
212
212
|
integer :x
|
213
213
|
def execute
|
@@ -221,7 +221,7 @@ AddThree.run!(x: 5)
|
|
221
221
|
To bring in filters from another interaction, use `import_filters`. Combined
|
222
222
|
with `inputs`, delegating to another interaction is a piece of cake.
|
223
223
|
|
224
|
-
```ruby
|
224
|
+
``` ruby
|
225
225
|
class AddAndDouble < ActiveInteraction::Base
|
226
226
|
import_filters Add
|
227
227
|
def execute
|
@@ -238,7 +238,7 @@ into `config/locales`. So, for example, let's say that (for whatever
|
|
238
238
|
reason) you want to print out everything backwards. Simply add
|
239
239
|
translations for ActiveInteraction to your `hsilgne` locale:
|
240
240
|
|
241
|
-
```
|
241
|
+
``` yaml
|
242
242
|
# config/locales/hsilgne.yml
|
243
243
|
hsilgne:
|
244
244
|
active_interaction:
|
@@ -264,7 +264,7 @@ hsilgne:
|
|
264
264
|
|
265
265
|
Then set your locale and run an interaction like normal:
|
266
266
|
|
267
|
-
```ruby
|
267
|
+
``` ruby
|
268
268
|
I18n.locale = :hsilgne
|
269
269
|
class Interaction < ActiveInteraction::Base
|
270
270
|
boolean :a
|
data/lib/active_interaction.rb
CHANGED
@@ -40,7 +40,7 @@ require 'active_interaction/base'
|
|
40
40
|
|
41
41
|
require 'active_interaction/backports'
|
42
42
|
|
43
|
-
I18n.load_path.unshift(Dir[File.expand_path(
|
43
|
+
I18n.load_path.unshift(*Dir[File.expand_path(
|
44
44
|
File.join(%w[active_interaction locale *.yml]), File.dirname(__FILE__))])
|
45
45
|
|
46
46
|
# Manage application specific business logic.
|
@@ -50,5 +50,5 @@ I18n.load_path.unshift(Dir[File.expand_path(
|
|
50
50
|
#
|
51
51
|
# @since 1.0.0
|
52
52
|
#
|
53
|
-
# @version 1.4.
|
53
|
+
# @version 1.4.1
|
54
54
|
module ActiveInteraction end
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
+
describe ActiveInteraction do
|
6
|
+
context 'I18n.load_path' do
|
7
|
+
it 'contains localization file paths at the beginning' do
|
8
|
+
expect(
|
9
|
+
I18n.load_path.first
|
10
|
+
).to match %r{active_interaction/locale/en.yml\z}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
I18nInteraction = Class.new(TestInteraction) do
|
6
16
|
hash :a do
|
7
17
|
hash :x
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
@@ -9,152 +9,152 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
12
|
+
date: 2014-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3.2'
|
21
|
-
- - <
|
21
|
+
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: '5'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '3.2'
|
31
|
-
- - <
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '5'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: bundler
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
type: :development
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.6'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: coveralls
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.7'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.7'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: guard-rspec
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4.2'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '4.2'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: guard-rubocop
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.1'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.1'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: kramdown
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.5'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.5'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: rake
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '10.3'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '10.3'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
119
|
name: rspec
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.1'
|
125
125
|
type: :development
|
126
126
|
prerelease: false
|
127
127
|
version_requirements: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '3.1'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: rubocop
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.28'
|
139
139
|
type: :development
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0.28'
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: yard
|
148
148
|
requirement: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.8'
|
153
153
|
type: :development
|
154
154
|
prerelease: false
|
155
155
|
version_requirements: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0.8'
|
160
160
|
description: Manage application specific business logic.
|
@@ -258,17 +258,17 @@ require_paths:
|
|
258
258
|
- lib
|
259
259
|
required_ruby_version: !ruby/object:Gem::Requirement
|
260
260
|
requirements:
|
261
|
-
- -
|
261
|
+
- - ">="
|
262
262
|
- !ruby/object:Gem::Version
|
263
263
|
version: 1.9.3
|
264
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
265
|
requirements:
|
266
|
-
- -
|
266
|
+
- - ">="
|
267
267
|
- !ruby/object:Gem::Version
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.
|
271
|
+
rubygems_version: 2.2.2
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Manage application specific business logic.
|