erratum_responsum 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 +8 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/Derk_Jan.xml +7 -0
- data/.idea/erratum_responsum.iml +19 -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 +380 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +17 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +34 -0
- data/LICENSE.txt +21 -0
- data/README.md +78 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/erratum_responsum.gemspec +43 -0
- data/lib/erratum_responsum/cancancan.rb +10 -0
- data/lib/erratum_responsum/version.rb +3 -0
- data/lib/erratum_responsum.rb +92 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f00882a31b52ea8b2d3ac4ff6fbbb7b2cafed666b983754a21f62a2e0d82fe08
|
4
|
+
data.tar.gz: afdfbc4f0e698701f1b97bd00c57be4d618d507bf5ace3c5fe5a1ede2edd93e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4836b5b1a3bf62d784df992aa05574902544f78b7cdf46846be8f96f743719ae94d5e4231579d702e5bcc054f8c06845d1125ee905ecc245df8a8214c7f72cbf
|
7
|
+
data.tar.gz: 07fc98eafcc65277ca45413e2c3f10697ac04402df93f1800c01fc94ad1c6febc12050acd04d3881211d0c40af51da5a95f735e1251bc3e234495e3b117654a8
|
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 erratum_responsum-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 erratum_responsum-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install erratum_responsum-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 erratum_responsum-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,19 @@
|
|
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="activesupport (v5.2.2, ruby-2.5.3-p105) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, ruby-2.5.3-p105) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.4, ruby-2.5.3-p105) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.5.3, ruby-2.5.3-p105) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.5.3-p105) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.5.3-p105) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.5.3-p105) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, ruby-2.5.3-p105) [gem]" level="application" />
|
18
|
+
</component>
|
19
|
+
</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/erratum_responsum.iml" filepath="$PROJECT_DIR$/.idea/erratum_responsum.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,380 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="c4503431-f959-4ccd-92ef-8862c5af3e2d" 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$/.rubocop.yml" afterDir="false" />
|
8
|
+
<change afterPath="$PROJECT_DIR$/.travis.yml" afterDir="false" />
|
9
|
+
<change afterPath="$PROJECT_DIR$/CODE_OF_CONDUCT.md" afterDir="false" />
|
10
|
+
<change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
|
11
|
+
<change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
|
12
|
+
<change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
13
|
+
<change afterPath="$PROJECT_DIR$/Rakefile" 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$/erratum_responsum.gemspec" afterDir="false" />
|
17
|
+
<change afterPath="$PROJECT_DIR$/lib/erratum_responsum.rb" afterDir="false" />
|
18
|
+
<change afterPath="$PROJECT_DIR$/lib/erratum_responsum/cancancan.rb" afterDir="false" />
|
19
|
+
<change afterPath="$PROJECT_DIR$/lib/erratum_responsum/version.rb" afterDir="false" />
|
20
|
+
<change afterPath="$PROJECT_DIR$/test/erratum_responsum_test.rb" afterDir="false" />
|
21
|
+
<change afterPath="$PROJECT_DIR$/test/test_helper.rb" afterDir="false" />
|
22
|
+
</list>
|
23
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
24
|
+
<option name="SHOW_DIALOG" value="false" />
|
25
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
26
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
27
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
28
|
+
</component>
|
29
|
+
<component name="FileEditorManager">
|
30
|
+
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
31
|
+
<file pinned="false" current-in-tab="true">
|
32
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
33
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
34
|
+
<state split_layout="SPLIT">
|
35
|
+
<first_editor relative-caret-position="488">
|
36
|
+
<caret line="77" column="128" selection-start-line="77" selection-start-column="128" selection-end-line="77" selection-end-column="128" />
|
37
|
+
</first_editor>
|
38
|
+
<second_editor />
|
39
|
+
</state>
|
40
|
+
</provider>
|
41
|
+
</entry>
|
42
|
+
</file>
|
43
|
+
</leaf>
|
44
|
+
</component>
|
45
|
+
<component name="FindInProjectRecents">
|
46
|
+
<findStrings>
|
47
|
+
<find>setup</find>
|
48
|
+
<find>NothingAccessibleBy</find>
|
49
|
+
<find>message</find>
|
50
|
+
<find>unsupported_media_type</find>
|
51
|
+
<find>error_code</find>
|
52
|
+
</findStrings>
|
53
|
+
</component>
|
54
|
+
<component name="Git.Settings">
|
55
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
56
|
+
</component>
|
57
|
+
<component name="IdeDocumentHistory">
|
58
|
+
<option name="CHANGED_PATHS">
|
59
|
+
<list>
|
60
|
+
<option value="$PROJECT_DIR$/erratum_responsum.gemspec" />
|
61
|
+
<option value="$PROJECT_DIR$/lib/erratum_responsum/cancancan.rb" />
|
62
|
+
<option value="$PROJECT_DIR$/lib/erratum_responsum/defaults.rb" />
|
63
|
+
<option value="$PROJECT_DIR$/test/erratum_responsum_test.rb" />
|
64
|
+
<option value="$PROJECT_DIR$/lib/erratum_responsum.rb" />
|
65
|
+
<option value="$PROJECT_DIR$/.travis.yml" />
|
66
|
+
<option value="$PROJECT_DIR$/README.md" />
|
67
|
+
</list>
|
68
|
+
</option>
|
69
|
+
</component>
|
70
|
+
<component name="ProjectConfigurationFiles">
|
71
|
+
<option name="files">
|
72
|
+
<list>
|
73
|
+
<option value="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
|
74
|
+
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
|
75
|
+
<option value="$PROJECT_DIR$/.idea/dictionaries/Derk_Jan.xml" />
|
76
|
+
</list>
|
77
|
+
</option>
|
78
|
+
</component>
|
79
|
+
<component name="ProjectFrameBounds" extendedState="6">
|
80
|
+
<option name="x" value="-12" />
|
81
|
+
<option name="y" value="-12" />
|
82
|
+
<option name="width" value="3866" />
|
83
|
+
<option name="height" value="2126" />
|
84
|
+
</component>
|
85
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
86
|
+
<component name="ProjectView">
|
87
|
+
<navigator proportions="" version="1">
|
88
|
+
<foldersAlwaysOnTop value="true" />
|
89
|
+
</navigator>
|
90
|
+
<panes>
|
91
|
+
<pane id="ProjectPane">
|
92
|
+
<subPane>
|
93
|
+
<expand>
|
94
|
+
<path>
|
95
|
+
<item name="erratum_responsum" type="b2602c69:ProjectViewProjectNode" />
|
96
|
+
<item name="erratum_responsum" type="462c0819:PsiDirectoryNode" />
|
97
|
+
</path>
|
98
|
+
<path>
|
99
|
+
<item name="erratum_responsum" type="b2602c69:ProjectViewProjectNode" />
|
100
|
+
<item name="erratum_responsum" type="462c0819:PsiDirectoryNode" />
|
101
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
102
|
+
</path>
|
103
|
+
<path>
|
104
|
+
<item name="erratum_responsum" type="b2602c69:ProjectViewProjectNode" />
|
105
|
+
<item name="erratum_responsum" type="462c0819:PsiDirectoryNode" />
|
106
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
107
|
+
<item name="erratum_responsum" type="462c0819:PsiDirectoryNode" />
|
108
|
+
</path>
|
109
|
+
<path>
|
110
|
+
<item name="erratum_responsum" type="b2602c69:ProjectViewProjectNode" />
|
111
|
+
<item name="erratum_responsum" type="462c0819:PsiDirectoryNode" />
|
112
|
+
<item name="test" type="462c0819:PsiDirectoryNode" />
|
113
|
+
</path>
|
114
|
+
<path>
|
115
|
+
<item name="erratum_responsum" type="b2602c69:ProjectViewProjectNode" />
|
116
|
+
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
|
117
|
+
</path>
|
118
|
+
</expand>
|
119
|
+
<select />
|
120
|
+
</subPane>
|
121
|
+
</pane>
|
122
|
+
<pane id="Scope" />
|
123
|
+
</panes>
|
124
|
+
</component>
|
125
|
+
<component name="PropertiesComponent">
|
126
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
127
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
128
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
129
|
+
<property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
|
130
|
+
</component>
|
131
|
+
<component name="RecentsManager">
|
132
|
+
<key name="CopyFile.RECENT_KEYS">
|
133
|
+
<recent name="C:\Users\Derk-Jan\Documents\Github\erratum_responsum" />
|
134
|
+
</key>
|
135
|
+
</component>
|
136
|
+
<component name="RunDashboard">
|
137
|
+
<option name="ruleStates">
|
138
|
+
<list>
|
139
|
+
<RuleState>
|
140
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
141
|
+
</RuleState>
|
142
|
+
<RuleState>
|
143
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
144
|
+
</RuleState>
|
145
|
+
</list>
|
146
|
+
</option>
|
147
|
+
</component>
|
148
|
+
<component name="RunManager">
|
149
|
+
<configuration name="test" type="RakeRunConfigurationType" factoryName="Rake">
|
150
|
+
<module name="erratum_responsum" />
|
151
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
|
152
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
153
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
154
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
155
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
156
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
157
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
158
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
159
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="test" />
|
160
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
|
161
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":test_unit " />
|
162
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
|
163
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
|
164
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
|
165
|
+
<method v="2" />
|
166
|
+
</configuration>
|
167
|
+
</component>
|
168
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
169
|
+
<component name="SvnConfiguration">
|
170
|
+
<configuration />
|
171
|
+
</component>
|
172
|
+
<component name="TaskManager">
|
173
|
+
<task active="true" id="Default" summary="Default task">
|
174
|
+
<changelist id="c4503431-f959-4ccd-92ef-8862c5af3e2d" name="Default Changelist" comment="" />
|
175
|
+
<created>1550144542662</created>
|
176
|
+
<option name="number" value="Default" />
|
177
|
+
<option name="presentableId" value="Default" />
|
178
|
+
<updated>1550144542662</updated>
|
179
|
+
<workItem from="1550144544949" duration="865000" />
|
180
|
+
<workItem from="1550146370823" duration="3000000" />
|
181
|
+
</task>
|
182
|
+
<servers />
|
183
|
+
</component>
|
184
|
+
<component name="TestHistory">
|
185
|
+
<history-entry file="test - 2019.02.14 at 13h 48m 11s.xml">
|
186
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
187
|
+
</history-entry>
|
188
|
+
<history-entry file="test - 2019.02.14 at 13h 48m 22s.xml">
|
189
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
190
|
+
</history-entry>
|
191
|
+
<history-entry file="test - 2019.02.14 at 13h 48m 34s.xml">
|
192
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
193
|
+
</history-entry>
|
194
|
+
<history-entry file="test - 2019.02.14 at 13h 50m 16s.xml">
|
195
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
196
|
+
</history-entry>
|
197
|
+
<history-entry file="test - 2019.02.14 at 13h 50m 31s.xml">
|
198
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
199
|
+
</history-entry>
|
200
|
+
<history-entry file="test - 2019.02.14 at 13h 50m 44s.xml">
|
201
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
202
|
+
</history-entry>
|
203
|
+
<history-entry file="test - 2019.02.14 at 13h 51m 04s.xml">
|
204
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
205
|
+
</history-entry>
|
206
|
+
<history-entry file="test - 2019.02.14 at 13h 53m 14s.xml">
|
207
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
208
|
+
</history-entry>
|
209
|
+
<history-entry file="test - 2019.02.14 at 13h 53m 55s.xml">
|
210
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
211
|
+
</history-entry>
|
212
|
+
<history-entry file="test - 2019.02.14 at 13h 54m 22s.xml">
|
213
|
+
<configuration name="test" configurationId="RakeRunConfigurationType" />
|
214
|
+
</history-entry>
|
215
|
+
</component>
|
216
|
+
<component name="TimeTrackingManager">
|
217
|
+
<option name="totallyTimeSpent" value="3865000" />
|
218
|
+
</component>
|
219
|
+
<component name="ToolWindowManager">
|
220
|
+
<frame x="-6" y="-6" width="1933" height="1063" extended-state="6" />
|
221
|
+
<editor active="true" />
|
222
|
+
<layout>
|
223
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25226668" />
|
224
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
225
|
+
<window_info id="Favorites" order="2" side_tool="true" />
|
226
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
227
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
228
|
+
<window_info anchor="bottom" id="Run" order="2" weight="0.33118972" />
|
229
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
230
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
231
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
232
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
233
|
+
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
234
|
+
<window_info anchor="bottom" id="Database Changes" order="8" />
|
235
|
+
<window_info anchor="bottom" id="Version Control" order="9" />
|
236
|
+
<window_info anchor="bottom" id="Terminal" order="10" visible="true" weight="0.33547696" />
|
237
|
+
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
|
238
|
+
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
239
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
240
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
241
|
+
<window_info anchor="right" id="Database" order="3" />
|
242
|
+
</layout>
|
243
|
+
</component>
|
244
|
+
<component name="TypeScriptGeneratedFilesManager">
|
245
|
+
<option name="version" value="1" />
|
246
|
+
</component>
|
247
|
+
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
248
|
+
<SUITE FILE_PATH="coverage/erratum_responsum@test.rcov" NAME="test Coverage Results" MODIFIED="1550148860957" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="erratum_responsum" />
|
249
|
+
</component>
|
250
|
+
<component name="editorHistoryManager">
|
251
|
+
<entry file="file://$PROJECT_DIR$/Gemfile.lock">
|
252
|
+
<provider selected="true" editor-type-id="text-editor">
|
253
|
+
<state relative-caret-position="153">
|
254
|
+
<caret line="9" column="17" selection-start-line="9" selection-start-column="4" selection-end-line="9" selection-end-column="17" />
|
255
|
+
</state>
|
256
|
+
</provider>
|
257
|
+
</entry>
|
258
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs25/kernel.rb">
|
259
|
+
<provider selected="true" editor-type-id="text-editor">
|
260
|
+
<state relative-caret-position="249">
|
261
|
+
<caret line="3546" column="8" selection-start-line="3546" selection-start-column="8" selection-end-line="3546" selection-end-column="8" />
|
262
|
+
</state>
|
263
|
+
</provider>
|
264
|
+
</entry>
|
265
|
+
<entry file="file://$PROJECT_DIR$/lib/erratum_responsum/cancancan.rb">
|
266
|
+
<provider selected="true" editor-type-id="text-editor">
|
267
|
+
<state relative-caret-position="170">
|
268
|
+
<caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
|
269
|
+
</state>
|
270
|
+
</provider>
|
271
|
+
</entry>
|
272
|
+
<entry file="file://$PROJECT_DIR$/lib/erratum_responsum/defaults.rb">
|
273
|
+
<provider selected="true" editor-type-id="text-editor">
|
274
|
+
<state relative-caret-position="102">
|
275
|
+
<caret line="6" column="6" lean-forward="true" selection-start-line="6" selection-start-column="6" selection-end-line="15" selection-end-column="73" />
|
276
|
+
</state>
|
277
|
+
</provider>
|
278
|
+
</entry>
|
279
|
+
<entry file="file://C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/hell.rb">
|
280
|
+
<provider selected="true" editor-type-id="text-editor">
|
281
|
+
<state relative-caret-position="34">
|
282
|
+
<caret line="2" column="16" selection-start-line="2" selection-start-column="16" selection-end-line="2" selection-end-column="16" />
|
283
|
+
</state>
|
284
|
+
</provider>
|
285
|
+
</entry>
|
286
|
+
<entry file="file://C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/minitest-5.11.3/lib/minitest/test.rb">
|
287
|
+
<provider selected="true" editor-type-id="text-editor">
|
288
|
+
<state relative-caret-position="-313">
|
289
|
+
<caret line="157" column="15" selection-start-line="157" selection-start-column="10" selection-end-line="157" selection-end-column="15" />
|
290
|
+
</state>
|
291
|
+
</provider>
|
292
|
+
</entry>
|
293
|
+
<entry file="file://C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/rescuable.rb">
|
294
|
+
<provider selected="true" editor-type-id="text-editor">
|
295
|
+
<state relative-caret-position="1347">
|
296
|
+
<caret line="164" column="6" lean-forward="true" selection-start-line="164" selection-start-column="6" selection-end-line="164" selection-end-column="60" />
|
297
|
+
</state>
|
298
|
+
</provider>
|
299
|
+
</entry>
|
300
|
+
<entry file="file://C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/module/attribute_accessors.rb">
|
301
|
+
<provider selected="true" editor-type-id="text-editor">
|
302
|
+
<state relative-caret-position="3621">
|
303
|
+
<caret line="213" column="23" selection-start-line="213" selection-start-column="9" selection-end-line="213" selection-end-column="23" />
|
304
|
+
</state>
|
305
|
+
</provider>
|
306
|
+
</entry>
|
307
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs25/standard_error.rb">
|
308
|
+
<provider selected="true" editor-type-id="text-editor">
|
309
|
+
<state relative-caret-position="374">
|
310
|
+
<caret line="22" column="6" selection-start-line="22" selection-start-column="6" selection-end-line="22" selection-end-column="6" />
|
311
|
+
</state>
|
312
|
+
</provider>
|
313
|
+
</entry>
|
314
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs25/runtime_error.rb">
|
315
|
+
<provider selected="true" editor-type-id="text-editor">
|
316
|
+
<state>
|
317
|
+
<caret column="6" lean-forward="true" selection-start-column="6" selection-end-column="6" />
|
318
|
+
</state>
|
319
|
+
</provider>
|
320
|
+
</entry>
|
321
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs25/module.rb">
|
322
|
+
<provider selected="true" editor-type-id="text-editor">
|
323
|
+
<state relative-caret-position="199">
|
324
|
+
<caret line="491" column="8" selection-start-line="491" selection-start-column="8" selection-end-line="491" selection-end-column="8" />
|
325
|
+
</state>
|
326
|
+
</provider>
|
327
|
+
</entry>
|
328
|
+
<entry file="file://$PROJECT_DIR$/erratum_responsum.gemspec">
|
329
|
+
<provider selected="true" editor-type-id="text-editor">
|
330
|
+
<state relative-caret-position="187">
|
331
|
+
<caret line="11" column="70" lean-forward="true" selection-start-line="11" selection-start-column="24" selection-end-line="11" selection-end-column="70" />
|
332
|
+
</state>
|
333
|
+
</provider>
|
334
|
+
</entry>
|
335
|
+
<entry file="file://$PROJECT_DIR$/test/erratum_responsum_test.rb">
|
336
|
+
<provider selected="true" editor-type-id="text-editor">
|
337
|
+
<state relative-caret-position="321">
|
338
|
+
<caret line="53" column="68" selection-start-line="53" selection-start-column="46" selection-end-line="53" selection-end-column="68" />
|
339
|
+
</state>
|
340
|
+
</provider>
|
341
|
+
</entry>
|
342
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
343
|
+
<provider selected="true" editor-type-id="text-editor">
|
344
|
+
<state relative-caret-position="68">
|
345
|
+
<caret line="4" lean-forward="true" selection-start-line="4" selection-end-line="4" />
|
346
|
+
</state>
|
347
|
+
</provider>
|
348
|
+
</entry>
|
349
|
+
<entry file="file://$PROJECT_DIR$/lib/erratum_responsum.rb">
|
350
|
+
<provider selected="true" editor-type-id="text-editor">
|
351
|
+
<state relative-caret-position="1479">
|
352
|
+
<caret line="87" column="16" selection-start-line="87" selection-start-column="6" selection-end-line="87" selection-end-column="16" />
|
353
|
+
</state>
|
354
|
+
</provider>
|
355
|
+
</entry>
|
356
|
+
<entry file="file://$PROJECT_DIR$/.rubocop.yml">
|
357
|
+
<provider selected="true" editor-type-id="text-editor" />
|
358
|
+
</entry>
|
359
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
360
|
+
<provider selected="true" editor-type-id="text-editor">
|
361
|
+
<state relative-caret-position="289">
|
362
|
+
<caret line="17" lean-forward="true" selection-start-line="17" selection-end-line="17" />
|
363
|
+
</state>
|
364
|
+
</provider>
|
365
|
+
</entry>
|
366
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
367
|
+
<provider selected="true" editor-type-id="text-editor" />
|
368
|
+
</entry>
|
369
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
370
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
371
|
+
<state split_layout="SPLIT">
|
372
|
+
<first_editor relative-caret-position="488">
|
373
|
+
<caret line="77" column="128" selection-start-line="77" selection-start-column="128" selection-end-line="77" selection-end-column="128" />
|
374
|
+
</first_editor>
|
375
|
+
<second_editor />
|
376
|
+
</state>
|
377
|
+
</provider>
|
378
|
+
</entry>
|
379
|
+
</component>
|
380
|
+
</project>
|
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
sudo: false
|
3
|
+
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
rvm:
|
6
|
+
- 2.5
|
7
|
+
- 2.6
|
8
|
+
- ruby-head
|
9
|
+
before_install:
|
10
|
+
- gem install bundler -v 2.0.1
|
11
|
+
- gem update --system
|
12
|
+
- gem --version
|
13
|
+
matrix:
|
14
|
+
allow_failures:
|
15
|
+
- rvm: ruby-head
|
16
|
+
install:
|
17
|
+
- bundle install --with development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
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,34 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
erratum_responsum (0.1.0)
|
5
|
+
activesupport
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (5.2.2)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
concurrent-ruby (1.1.4)
|
16
|
+
i18n (1.5.3)
|
17
|
+
concurrent-ruby (~> 1.0)
|
18
|
+
minitest (5.11.3)
|
19
|
+
rake (10.5.0)
|
20
|
+
thread_safe (0.3.6)
|
21
|
+
tzinfo (1.2.5)
|
22
|
+
thread_safe (~> 0.1)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
x64-mingw32
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 2.0)
|
29
|
+
erratum_responsum!
|
30
|
+
minitest (~> 5.0)
|
31
|
+
rake (~> 10.0)
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
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,78 @@
|
|
1
|
+
# ErratumResponsum
|
2
|
+
|
3
|
+
[![Build Status: master](https://travis-ci.com/XPBytes/erratum_responsum.svg)](https://travis-ci.com/XPBytes/erratum_responsum)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/erratum_responsum.svg)](https://badge.fury.io/rb/erratum_responsum)
|
5
|
+
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
|
6
|
+
|
7
|
+
Error response handlers for a Rails controller.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'erratum_responsum'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install erratum_responsum
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Add the concern to your `ApplicationController` or `ApiController`
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'erratum_responsum'
|
31
|
+
|
32
|
+
class ApiController < ActionController::API
|
33
|
+
include ErratumResponsum
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
### Media Type
|
38
|
+
|
39
|
+
You can optionally set the class variable `error_media_type` to change the `Content-Type` of error responses.
|
40
|
+
```ruby
|
41
|
+
self.error_media_type = 'application/vnd.xpbytes.errors.v1+json'
|
42
|
+
```
|
43
|
+
|
44
|
+
### Rescue Errors
|
45
|
+
|
46
|
+
In order to use the error responses, use `rescue_from` to handle them:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
rescue_from CanCan::AccessDenied, AuthorizedTransaction::TransactionUnauthorized, with: :forbidden
|
50
|
+
rescue_from OptimisticallyStale::MissingLockVersion, ActionController::BadRequest,
|
51
|
+
RequestMissingParam, with: :bad_request
|
52
|
+
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
53
|
+
rescue_from ActionController::UnknownFormat, NoAcceptSerializer, with: :not_acceptable
|
54
|
+
rescue_from ResourceGone, with: :gone
|
55
|
+
rescue_from ActiveRecord::StatementInvalid, ActiveRecord::RecordInvalid,
|
56
|
+
ContentDoesNotMatchContentType, with: :unprocessable_entity
|
57
|
+
rescue_from ActiveRecord::RecordNotUnique, ActiveRecord::StaleObjectError, with: :conflict
|
58
|
+
rescue_from ContentTypeNotRecognised, with: :unsupported_media_type
|
59
|
+
```
|
60
|
+
|
61
|
+
Now, when one of these error is raised in a controller action, the error response is generated automatically.
|
62
|
+
|
63
|
+
When the exception has more information, such as an `error_code`, the code will use that instead, prefixed with `Ex`.
|
64
|
+
If there is no such information, the error class name is used to generate the error code, prefixed with `Gx`.
|
65
|
+
Change this behaviour by overriding `def error_code(error)`.
|
66
|
+
|
67
|
+
## Development
|
68
|
+
|
69
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can
|
70
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
71
|
+
|
72
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
73
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
74
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
Bug reports and pull requests are welcome on GitHub at [XPBytes/erratum_responsum](https://github.com/XPBytes/erratum_responsum).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "erratum_responsum"
|
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,43 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "erratum_responsum/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "erratum_responsum"
|
8
|
+
spec.version = ErratumResponsum::VERSION
|
9
|
+
spec.authors = ["Derk-Jan Karrenbeld"]
|
10
|
+
spec.email = ["derk-jan@xpbytes.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Error response handlers for a Rails controller'
|
13
|
+
spec.homepage = 'https://github.com/XPBytes/erratum_responsum'
|
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"] = "https://github.com/XPBytes/erratum_responsum"
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/XPBytes/erratum_responsum/issues"
|
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'
|
39
|
+
|
40
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
43
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'cancan/exceptions'
|
2
|
+
|
3
|
+
module ErratumResponsum
|
4
|
+
class NothingAccessibleBy < CanCan::AccessDenied
|
5
|
+
def initialize(model)
|
6
|
+
# noinspection RubyArgCount
|
7
|
+
super format('You\'re not allowed to access that %<model>s', model: model), nil, model
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'erratum_responsum/version'
|
2
|
+
require 'digest'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'cancancan'
|
6
|
+
require 'erratum_responsum/cancancan'
|
7
|
+
rescue LoadError
|
8
|
+
# no-op
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'active_support/concern'
|
12
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
13
|
+
|
14
|
+
module ErratumResponsum
|
15
|
+
extend ActiveSupport::Concern
|
16
|
+
|
17
|
+
cattr_accessor :error_media_type
|
18
|
+
self.error_media_type = 'application/json'
|
19
|
+
|
20
|
+
# 400
|
21
|
+
def bad_request(*exception)
|
22
|
+
render json: { errors: serialize_errors(exception) },
|
23
|
+
status: :bad_request,
|
24
|
+
content_type: ErratumResponsum.error_media_type
|
25
|
+
end
|
26
|
+
|
27
|
+
# 403
|
28
|
+
def forbidden(exception)
|
29
|
+
render json: { errors: serialize_errors(exception) },
|
30
|
+
status: :forbidden,
|
31
|
+
content_type: ErratumResponsum.error_media_type
|
32
|
+
end
|
33
|
+
|
34
|
+
# 404
|
35
|
+
def not_found(exception)
|
36
|
+
if defined?(NothingAccessibleBy) && exception.message.include?('TRUE=FALSE')
|
37
|
+
# When CanCanCan can not find a clause for an associated model, when using accessible_by, it will use TRUE=FALSE
|
38
|
+
# instead of throwing a CanCan::AccessDenied.
|
39
|
+
return forbidden(NothingAccessibleBy.new(exception.model))
|
40
|
+
end
|
41
|
+
|
42
|
+
render json: { errors: serialize_errors(exception) },
|
43
|
+
status: :not_found,
|
44
|
+
content_type: ErratumResponsum.error_media_type
|
45
|
+
end
|
46
|
+
|
47
|
+
# 406
|
48
|
+
def not_acceptable(exception)
|
49
|
+
render json: { errors: serialize_errors(exception) },
|
50
|
+
status: :not_acceptable,
|
51
|
+
content_type: ErratumResponsum.error_media_type
|
52
|
+
end
|
53
|
+
|
54
|
+
# 410
|
55
|
+
def gone(exception)
|
56
|
+
render json: { errors: serialize_errors(exception) },
|
57
|
+
status: :gone,
|
58
|
+
content_type: ErratumResponsum.error_media_type
|
59
|
+
end
|
60
|
+
|
61
|
+
# 409
|
62
|
+
def conflict(exception)
|
63
|
+
render json: { errors: serialize_errors(exception) },
|
64
|
+
status: :conflict,
|
65
|
+
content_type: ErratumResponsum.error_media_type
|
66
|
+
end
|
67
|
+
|
68
|
+
# 415
|
69
|
+
def unsupported_media_type(exception)
|
70
|
+
render json: { errors: serialize_errors(exception) },
|
71
|
+
status: :unsupported_media_type,
|
72
|
+
content_type: ErratumResponsum.error_media_type
|
73
|
+
end
|
74
|
+
|
75
|
+
# 422
|
76
|
+
def unprocessable_entity(exception)
|
77
|
+
render json: { errors: serialize_errors(exception) },
|
78
|
+
status: :unprocessable_entity,
|
79
|
+
content_type: ErratumResponsum.error_media_type
|
80
|
+
end
|
81
|
+
|
82
|
+
def serialize_errors(errors)
|
83
|
+
Array(errors).map do |error|
|
84
|
+
{ message: error.respond_to?(:message) ? error.message : error, code: error_code(error) }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def error_code(error)
|
89
|
+
return 'Ex' + String(error.send(:error_code)) if error.respond_to?(:error_code)
|
90
|
+
'Gx' + Digest::MD5.hexdigest(error.class.name)
|
91
|
+
end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erratum_responsum
|
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: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- derk-jan@xpbytes.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".idea/.rakeTasks"
|
78
|
+
- ".idea/dictionaries/Derk_Jan.xml"
|
79
|
+
- ".idea/erratum_responsum.iml"
|
80
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
81
|
+
- ".idea/misc.xml"
|
82
|
+
- ".idea/modules.xml"
|
83
|
+
- ".idea/vcs.xml"
|
84
|
+
- ".idea/workspace.xml"
|
85
|
+
- ".rubocop.yml"
|
86
|
+
- ".travis.yml"
|
87
|
+
- CODE_OF_CONDUCT.md
|
88
|
+
- Gemfile
|
89
|
+
- Gemfile.lock
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- bin/console
|
94
|
+
- bin/setup
|
95
|
+
- erratum_responsum.gemspec
|
96
|
+
- lib/erratum_responsum.rb
|
97
|
+
- lib/erratum_responsum/cancancan.rb
|
98
|
+
- lib/erratum_responsum/version.rb
|
99
|
+
homepage: https://github.com/XPBytes/erratum_responsum
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata:
|
103
|
+
homepage_uri: https://github.com/XPBytes/erratum_responsum
|
104
|
+
source_code_uri: https://github.com/XPBytes/erratum_responsum
|
105
|
+
changelog_uri: https://github.com/XPBytes/erratum_responsum/issues
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.7.6
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Error response handlers for a Rails controller
|
126
|
+
test_files: []
|