authorized_transaction 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/authorized_transaction.iml +22 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +261 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +42 -0
- data/LICENSE.txt +21 -0
- data/README.md +76 -0
- data/Rakefile +10 -0
- data/authorized_transaction.gemspec +44 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/authorized_transaction/version.rb +3 -0
- data/lib/authorized_transaction.rb +63 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b5043d7e3bfac05a1f32dbe8b5417e1b56ec59e158bea69946fcc1af617150ba
|
4
|
+
data.tar.gz: f52cabed7f581608977dd608c02d40e0679f0888d4d9d48b666562802e85243d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 174f43b166a105ca68b97c036df68edbb7caa3f7083eeeba313179a34cab10215395fc70c0fdee33e4dc01b273de46990dc168aba4297b0ba0f09ebacb82c703
|
7
|
+
data.tar.gz: 5b1301039126180837ac0e8020f7cd9126d6fbb331d8112d5d8a663f07258d0310a4d0d1f917baea92ca78d0e0af6cb347c1693c519fbf4c4c91e529c66b139d
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build authorized_transaction-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install authorized_transaction-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install authorized_transaction-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push authorized_transaction-0.1.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="jdk" jdkName="ruby-2.5.3-p105" jdkType="RUBY_SDK" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.2.2, ruby-2.5.3-p105) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.2.2, ruby-2.5.3-p105) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.2, ruby-2.5.3-p105) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="arel (v9.0.0, ruby-2.5.3-p105) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, ruby-2.5.3-p105) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.4, ruby-2.5.3-p105) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.5.3, ruby-2.5.3-p105) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.5.3-p105) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.5.3-p105) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.5.3-p105) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, ruby-2.5.3-p105) [gem]" level="application" />
|
21
|
+
</component>
|
22
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.4.4-p296" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/authorized_transaction.iml" filepath="$PROJECT_DIR$/.idea/authorized_transaction.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="f2d00257-c325-410d-b9b5-9ac44fbd2203" name="Default Changelist" comment="">
|
5
|
+
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
6
|
+
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
7
|
+
<change afterPath="$PROJECT_DIR$/.travis.yml" afterDir="false" />
|
8
|
+
<change afterPath="$PROJECT_DIR$/CODE_OF_CONDUCT.md" afterDir="false" />
|
9
|
+
<change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
|
10
|
+
<change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
|
11
|
+
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
12
|
+
<change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
|
13
|
+
<change afterPath="$PROJECT_DIR$/authorized_transaction.gemspec" afterDir="false" />
|
14
|
+
<change afterPath="$PROJECT_DIR$/bin/console" afterDir="false" />
|
15
|
+
<change afterPath="$PROJECT_DIR$/bin/setup" afterDir="false" />
|
16
|
+
<change afterPath="$PROJECT_DIR$/lib/authorized_transaction.rb" afterDir="false" />
|
17
|
+
<change afterPath="$PROJECT_DIR$/lib/authorized_transaction/version.rb" afterDir="false" />
|
18
|
+
<change afterPath="$PROJECT_DIR$/test/authorized_transaction_test.rb" afterDir="false" />
|
19
|
+
<change afterPath="$PROJECT_DIR$/test/test_helper.rb" afterDir="false" />
|
20
|
+
</list>
|
21
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
22
|
+
<option name="SHOW_DIALOG" value="false" />
|
23
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
24
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
25
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
26
|
+
</component>
|
27
|
+
<component name="FileEditorManager">
|
28
|
+
<leaf>
|
29
|
+
<file pinned="false" current-in-tab="false">
|
30
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
31
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
32
|
+
<state split_layout="SPLIT">
|
33
|
+
<first_editor relative-caret-position="323">
|
34
|
+
<caret line="19" lean-forward="true" selection-start-line="19" selection-end-line="19" />
|
35
|
+
</first_editor>
|
36
|
+
<second_editor />
|
37
|
+
</state>
|
38
|
+
</provider>
|
39
|
+
</entry>
|
40
|
+
</file>
|
41
|
+
<file pinned="false" current-in-tab="false">
|
42
|
+
<entry file="file://$PROJECT_DIR$/test/test_helper.rb">
|
43
|
+
<provider selected="true" editor-type-id="text-editor" />
|
44
|
+
</entry>
|
45
|
+
</file>
|
46
|
+
<file pinned="false" current-in-tab="true">
|
47
|
+
<entry file="file://$PROJECT_DIR$/test/authorized_transaction_test.rb">
|
48
|
+
<provider selected="true" editor-type-id="text-editor">
|
49
|
+
<state relative-caret-position="85">
|
50
|
+
<caret line="5" column="5" selection-start-line="5" selection-start-column="5" selection-end-line="5" selection-end-column="5" />
|
51
|
+
</state>
|
52
|
+
</provider>
|
53
|
+
</entry>
|
54
|
+
</file>
|
55
|
+
<file pinned="false" current-in-tab="false">
|
56
|
+
<entry file="file://$PROJECT_DIR$/authorized_transaction.gemspec">
|
57
|
+
<provider selected="true" editor-type-id="text-editor">
|
58
|
+
<state relative-caret-position="442">
|
59
|
+
<caret line="39" selection-start-line="39" selection-end-line="39" />
|
60
|
+
</state>
|
61
|
+
</provider>
|
62
|
+
</entry>
|
63
|
+
</file>
|
64
|
+
</leaf>
|
65
|
+
</component>
|
66
|
+
<component name="FindInProjectRecents">
|
67
|
+
<findStrings>
|
68
|
+
<find>erratum_responsum</find>
|
69
|
+
</findStrings>
|
70
|
+
<replaceStrings>
|
71
|
+
<replace>authorized_transaction</replace>
|
72
|
+
</replaceStrings>
|
73
|
+
</component>
|
74
|
+
<component name="Git.Settings">
|
75
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
76
|
+
</component>
|
77
|
+
<component name="IdeDocumentHistory">
|
78
|
+
<option name="CHANGED_PATHS">
|
79
|
+
<list>
|
80
|
+
<option value="$PROJECT_DIR$/authorized_transaction.gemspec" />
|
81
|
+
<option value="$PROJECT_DIR$/lib/authorized_transaction.rb" />
|
82
|
+
<option value="$PROJECT_DIR$/README.md" />
|
83
|
+
<option value="$PROJECT_DIR$/test/authorized_transaction_test.rb" />
|
84
|
+
</list>
|
85
|
+
</option>
|
86
|
+
</component>
|
87
|
+
<component name="ProjectConfigurationFiles">
|
88
|
+
<option name="files">
|
89
|
+
<list>
|
90
|
+
<option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
|
91
|
+
<option value="$PROJECT_DIR$/.idea/authorized_transaction.iml" />
|
92
|
+
<option value="$PROJECT_DIR$/.idea/misc.xml" />
|
93
|
+
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
94
|
+
<option value="$PROJECT_DIR$/.idea/modules.xml" />
|
95
|
+
</list>
|
96
|
+
</option>
|
97
|
+
</component>
|
98
|
+
<component name="ProjectFrameBounds" extendedState="7">
|
99
|
+
<option name="x" value="1386" />
|
100
|
+
<option name="y" value="550" />
|
101
|
+
<option name="width" value="3866" />
|
102
|
+
<option name="height" value="2126" />
|
103
|
+
</component>
|
104
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
105
|
+
<component name="ProjectView">
|
106
|
+
<navigator proportions="" version="1">
|
107
|
+
<foldersAlwaysOnTop value="true" />
|
108
|
+
</navigator>
|
109
|
+
<panes>
|
110
|
+
<pane id="Scope" />
|
111
|
+
<pane id="ProjectPane">
|
112
|
+
<subPane>
|
113
|
+
<expand>
|
114
|
+
<path>
|
115
|
+
<item name="authorized_transaction" type="b2602c69:ProjectViewProjectNode" />
|
116
|
+
<item name="authorized_transaction" type="462c0819:PsiDirectoryNode" />
|
117
|
+
</path>
|
118
|
+
<path>
|
119
|
+
<item name="authorized_transaction" type="b2602c69:ProjectViewProjectNode" />
|
120
|
+
<item name="authorized_transaction" type="462c0819:PsiDirectoryNode" />
|
121
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
122
|
+
</path>
|
123
|
+
<path>
|
124
|
+
<item name="authorized_transaction" type="b2602c69:ProjectViewProjectNode" />
|
125
|
+
<item name="authorized_transaction" type="462c0819:PsiDirectoryNode" />
|
126
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
127
|
+
<item name="authorized_transaction" type="462c0819:PsiDirectoryNode" />
|
128
|
+
</path>
|
129
|
+
<path>
|
130
|
+
<item name="authorized_transaction" type="b2602c69:ProjectViewProjectNode" />
|
131
|
+
<item name="authorized_transaction" type="462c0819:PsiDirectoryNode" />
|
132
|
+
<item name="test" type="462c0819:PsiDirectoryNode" />
|
133
|
+
</path>
|
134
|
+
</expand>
|
135
|
+
<select />
|
136
|
+
</subPane>
|
137
|
+
</pane>
|
138
|
+
</panes>
|
139
|
+
</component>
|
140
|
+
<component name="PropertiesComponent">
|
141
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
142
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
143
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
144
|
+
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
145
|
+
</component>
|
146
|
+
<component name="RunDashboard">
|
147
|
+
<option name="ruleStates">
|
148
|
+
<list>
|
149
|
+
<RuleState>
|
150
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
151
|
+
</RuleState>
|
152
|
+
<RuleState>
|
153
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
154
|
+
</RuleState>
|
155
|
+
</list>
|
156
|
+
</option>
|
157
|
+
</component>
|
158
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
159
|
+
<component name="SvnConfiguration">
|
160
|
+
<configuration />
|
161
|
+
</component>
|
162
|
+
<component name="TaskManager">
|
163
|
+
<task active="true" id="Default" summary="Default task">
|
164
|
+
<changelist id="f2d00257-c325-410d-b9b5-9ac44fbd2203" name="Default Changelist" comment="" />
|
165
|
+
<created>1550153400549</created>
|
166
|
+
<option name="number" value="Default" />
|
167
|
+
<option name="presentableId" value="Default" />
|
168
|
+
<updated>1550153400549</updated>
|
169
|
+
<workItem from="1550153402216" duration="989000" />
|
170
|
+
</task>
|
171
|
+
<servers />
|
172
|
+
</component>
|
173
|
+
<component name="TimeTrackingManager">
|
174
|
+
<option name="totallyTimeSpent" value="989000" />
|
175
|
+
</component>
|
176
|
+
<component name="ToolWindowManager">
|
177
|
+
<frame x="-6" y="-6" width="1933" height="1063" extended-state="6" />
|
178
|
+
<editor active="true" />
|
179
|
+
<layout>
|
180
|
+
<window_info id="Favorites" side_tool="true" />
|
181
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2496" />
|
182
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
183
|
+
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
184
|
+
<window_info anchor="bottom" id="Database Changes" />
|
185
|
+
<window_info anchor="bottom" id="Version Control" />
|
186
|
+
<window_info anchor="bottom" id="Terminal" />
|
187
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
188
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
189
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
190
|
+
<window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.3290461" />
|
191
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
192
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
193
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
194
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
195
|
+
<window_info anchor="right" id="Database" />
|
196
|
+
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
197
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
198
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
199
|
+
</layout>
|
200
|
+
</component>
|
201
|
+
<component name="TypeScriptGeneratedFilesManager">
|
202
|
+
<option name="version" value="1" />
|
203
|
+
</component>
|
204
|
+
<component name="editorHistoryManager">
|
205
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs25/runtime_error.rb">
|
206
|
+
<provider selected="true" editor-type-id="text-editor">
|
207
|
+
<state relative-caret-position="255">
|
208
|
+
<caret line="15" column="6" selection-start-line="15" selection-start-column="6" selection-end-line="15" selection-end-column="6" />
|
209
|
+
</state>
|
210
|
+
</provider>
|
211
|
+
</entry>
|
212
|
+
<entry file="file://C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/transactions.rb">
|
213
|
+
<provider selected="true" editor-type-id="text-editor">
|
214
|
+
<state relative-caret-position="-4">
|
215
|
+
<caret line="84" column="29" lean-forward="true" selection-start-line="84" selection-start-column="29" selection-end-line="84" selection-end-column="29" />
|
216
|
+
</state>
|
217
|
+
</provider>
|
218
|
+
</entry>
|
219
|
+
<entry file="file://C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/concurrent-ruby-1.1.4/lib/concurrent/agent.rb">
|
220
|
+
<provider selected="true" editor-type-id="text-editor">
|
221
|
+
<state relative-caret-position="404">
|
222
|
+
<caret line="161" column="21" selection-start-line="161" selection-start-column="21" selection-end-line="161" selection-end-column="21" />
|
223
|
+
</state>
|
224
|
+
</provider>
|
225
|
+
</entry>
|
226
|
+
<entry file="file://$PROJECT_DIR$/authorized_transaction.gemspec">
|
227
|
+
<provider selected="true" editor-type-id="text-editor">
|
228
|
+
<state relative-caret-position="442">
|
229
|
+
<caret line="39" selection-start-line="39" selection-end-line="39" />
|
230
|
+
</state>
|
231
|
+
</provider>
|
232
|
+
</entry>
|
233
|
+
<entry file="file://$PROJECT_DIR$/lib/authorized_transaction.rb">
|
234
|
+
<provider selected="true" editor-type-id="text-editor">
|
235
|
+
<state relative-caret-position="329">
|
236
|
+
<caret line="47" column="8" selection-start-line="47" selection-start-column="8" selection-end-line="47" selection-end-column="8" />
|
237
|
+
</state>
|
238
|
+
</provider>
|
239
|
+
</entry>
|
240
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
241
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
242
|
+
<state split_layout="SPLIT">
|
243
|
+
<first_editor relative-caret-position="323">
|
244
|
+
<caret line="19" lean-forward="true" selection-start-line="19" selection-end-line="19" />
|
245
|
+
</first_editor>
|
246
|
+
<second_editor />
|
247
|
+
</state>
|
248
|
+
</provider>
|
249
|
+
</entry>
|
250
|
+
<entry file="file://$PROJECT_DIR$/test/test_helper.rb">
|
251
|
+
<provider selected="true" editor-type-id="text-editor" />
|
252
|
+
</entry>
|
253
|
+
<entry file="file://$PROJECT_DIR$/test/authorized_transaction_test.rb">
|
254
|
+
<provider selected="true" editor-type-id="text-editor">
|
255
|
+
<state relative-caret-position="85">
|
256
|
+
<caret line="5" column="5" selection-start-line="5" selection-start-column="5" selection-end-line="5" selection-end-column="5" />
|
257
|
+
</state>
|
258
|
+
</provider>
|
259
|
+
</entry>
|
260
|
+
</component>
|
261
|
+
</project>
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at derk-jan+github@karrenbeld.info. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
authorized_transaction (0.1.0)
|
5
|
+
activerecord (>= 4.0.0)
|
6
|
+
activesupport (>= 4.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (5.2.2)
|
12
|
+
activesupport (= 5.2.2)
|
13
|
+
activerecord (5.2.2)
|
14
|
+
activemodel (= 5.2.2)
|
15
|
+
activesupport (= 5.2.2)
|
16
|
+
arel (>= 9.0)
|
17
|
+
activesupport (5.2.2)
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
+
i18n (>= 0.7, < 2)
|
20
|
+
minitest (~> 5.1)
|
21
|
+
tzinfo (~> 1.1)
|
22
|
+
arel (9.0.0)
|
23
|
+
concurrent-ruby (1.1.4)
|
24
|
+
i18n (1.5.3)
|
25
|
+
concurrent-ruby (~> 1.0)
|
26
|
+
minitest (5.11.3)
|
27
|
+
rake (10.5.0)
|
28
|
+
thread_safe (0.3.6)
|
29
|
+
tzinfo (1.2.5)
|
30
|
+
thread_safe (~> 0.1)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
x64-mingw32
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
authorized_transaction!
|
37
|
+
bundler (~> 2.0)
|
38
|
+
minitest (~> 5.0)
|
39
|
+
rake (~> 10.0)
|
40
|
+
|
41
|
+
BUNDLED WITH
|
42
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Derk-Jan Karrenbeld
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# AuthorizedTransaction
|
2
|
+
|
3
|
+
[![Build Status: master](https://travis-ci.com/XPBytes/authorized_transaction.svg)](https://travis-ci.com/XPBytes/authorized_transaction)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/authorized_transaction.svg)](https://badge.fury.io/rb/authorized_transaction)
|
5
|
+
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
|
6
|
+
|
7
|
+
Authorize a certain block with cancan
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'authorized_transaction'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install authorized_transaction
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Wrap whatever you want to be authorized in an `authorized_transaction` block:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'authorized_transaction'
|
31
|
+
|
32
|
+
class BookController < ApiController
|
33
|
+
def create
|
34
|
+
book = authorized_transaction { CreateAndReturnBook.call(params) }
|
35
|
+
render json: book, status: :created
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
Implicitly the current `action_name` will be used with `can? action, resource`. You can pass `action: ...` to the block
|
41
|
+
to set it explicitly:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
class Book::SignatureController < ApiController
|
45
|
+
def create
|
46
|
+
signature = authorized_transaction(action: :sign) { SignBook.call(params) }
|
47
|
+
render json: signature, status: :created
|
48
|
+
end
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
Authorization work on single resources, or enumerables:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
class Book::SignatureController < ApiController
|
56
|
+
def show
|
57
|
+
_, signature = authorized_transaction do
|
58
|
+
[FindBook.call(params), FindSignature.call(params)]
|
59
|
+
end
|
60
|
+
render json: signature, status: :created
|
61
|
+
end
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
65
|
+
## Development
|
66
|
+
|
67
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
|
68
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
|
70
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
71
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
72
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
Bug reports and pull requests are welcome on GitHub at [XPBytes/authorized_transaction](https://github.com/XPBytes/authorized_transaction).
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "authorized_transaction/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "authorized_transaction"
|
8
|
+
spec.version = AuthorizedTransaction::VERSION
|
9
|
+
spec.authors = ["Derk-Jan Karrenbeld"]
|
10
|
+
spec.email = ["derk-jan@xpbytes.com"]
|
11
|
+
|
12
|
+
spec.summary = 'CanCan supported transaction on top of ActiveRecord'
|
13
|
+
spec.homepage = 'https://github.com/XPBytes/authorized_transaction'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
23
|
+
spec.metadata["changelog_uri"] = spec.homepage + '/CHANGELOG.md'
|
24
|
+
else
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
+
"public gem pushes."
|
27
|
+
end
|
28
|
+
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
|
+
end
|
34
|
+
spec.bindir = "exe"
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
spec.add_dependency 'activesupport', '>= 4.0.0'
|
39
|
+
spec.add_dependency 'activerecord', '>= 4.0.0'
|
40
|
+
|
41
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
42
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
43
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
44
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "authorized_transaction"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "authorized_transaction/version"
|
2
|
+
|
3
|
+
require 'active_record'
|
4
|
+
require 'active_support/concern'
|
5
|
+
|
6
|
+
module AuthorizedTransaction
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
class TransactionUnauthorized < RuntimeError
|
11
|
+
attr_reader :action, :resource
|
12
|
+
|
13
|
+
def initialize(action, resource)
|
14
|
+
self.action = action
|
15
|
+
self.resource = resource
|
16
|
+
super format('You are not allowed to perform %<action>s on %<klazz>s', action: action, klazz: resource.class.name)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_writer :action, :resource
|
22
|
+
end
|
23
|
+
|
24
|
+
def implicit_action
|
25
|
+
params[:action]
|
26
|
+
end
|
27
|
+
|
28
|
+
included do
|
29
|
+
##
|
30
|
+
# Wraps a block in a transaction after which the authorization check runs, using the controller action as default
|
31
|
+
# +action+ and the return value of the block as +resource+
|
32
|
+
#
|
33
|
+
# @param action [Symbol]
|
34
|
+
# @yields a block to run actions and return a resource
|
35
|
+
#
|
36
|
+
# @throws TransactionUnauthorized
|
37
|
+
# when the +resource+ could not be +action+
|
38
|
+
#
|
39
|
+
# @example create a book first and check afterwards if it was allowed
|
40
|
+
#
|
41
|
+
# class BookController < ApiController
|
42
|
+
# def create
|
43
|
+
# @book = authorized_transaction { CreateAndReturnBook.call(params) }
|
44
|
+
# render json: @book, status: :created
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
def authorized_transaction(action: implicit_action)
|
49
|
+
ActiveRecord::Base.transaction do
|
50
|
+
resource = yield
|
51
|
+
authorize! action, resource
|
52
|
+
resource
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def authorize!(action, resource)
|
57
|
+
Array(resource).each do |r|
|
58
|
+
next if can?(action, r)
|
59
|
+
raise TransactionUnauthorized.new(action, r)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: authorized_transaction
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Derk-Jan Karrenbeld
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activerecord
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- derk-jan@xpbytes.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".idea/.rakeTasks"
|
92
|
+
- ".idea/authorized_transaction.iml"
|
93
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
94
|
+
- ".idea/misc.xml"
|
95
|
+
- ".idea/modules.xml"
|
96
|
+
- ".idea/vcs.xml"
|
97
|
+
- ".idea/workspace.xml"
|
98
|
+
- ".travis.yml"
|
99
|
+
- CODE_OF_CONDUCT.md
|
100
|
+
- Gemfile
|
101
|
+
- Gemfile.lock
|
102
|
+
- LICENSE.txt
|
103
|
+
- README.md
|
104
|
+
- Rakefile
|
105
|
+
- authorized_transaction.gemspec
|
106
|
+
- bin/console
|
107
|
+
- bin/setup
|
108
|
+
- lib/authorized_transaction.rb
|
109
|
+
- lib/authorized_transaction/version.rb
|
110
|
+
homepage: https://github.com/XPBytes/authorized_transaction
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata:
|
114
|
+
homepage_uri: https://github.com/XPBytes/authorized_transaction
|
115
|
+
source_code_uri: https://github.com/XPBytes/authorized_transaction
|
116
|
+
changelog_uri: https://github.com/XPBytes/authorized_transaction/CHANGELOG.md
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.7.6
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: CanCan supported transaction on top of ActiveRecord
|
137
|
+
test_files: []
|