share-link 2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27f239ff4b7e08c182414cdeeb53a11077d073f7
4
+ data.tar.gz: bf83604b1d48a26f5607491bfafab8c9e5300415
5
+ SHA512:
6
+ metadata.gz: 7e4fc9c23bbbfa0505d31d3f5fc568c105bd66ab80306be581530e5c5755dc8f7130e0e72740b6e262d4d080c4c48aa9c1dbbec8dccb14773c76275f63b4e619
7
+ data.tar.gz: e2d7ae29992a856ad0036591137e18f0cdef266b03d82b0f3be9362fa4217922d9fa56651e33a4b20fdfd0fe263c67f318c075312713f072e7257963c6287a4f
data/.byebug_history ADDED
@@ -0,0 +1,3 @@
1
+ q!
2
+ data
3
+
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
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" /></Settings>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,10 @@
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="NodePackageJsonFileManager">
7
+ <packageJsonPaths />
8
+ </component>
9
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.0.0-p648" project-jdk-type="RUBY_SDK" />
10
+ </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/share-link.iml" filepath="$PROJECT_DIR$/.idea/share-link.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,26 @@
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="inheritedJdk" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.2, ruby-2.0.0-p648) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.1, ruby-2.0.0-p648) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.4, ruby-2.0.0-p648) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.0.0-p648) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.3.0, ruby-2.0.0-p648) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="jwt (v2.1.0, ruby-2.0.0-p648) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.0.0-p648) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.0.0-p648) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, ruby-2.0.0-p648) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, ruby-2.0.0-p648) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.2, ruby-2.0.0-p648) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, ruby-2.0.0-p648) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, ruby-2.0.0-p648) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, ruby-2.0.0-p648) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, ruby-2.0.0-p648) [gem]" level="application" />
25
+ </component>
26
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,293 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="7fba77f7-fc22-4f2a-a2bc-71653b21e7d0" name="Default Changelist" comment="" />
5
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
6
+ <option name="SHOW_DIALOG" value="false" />
7
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
8
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
9
+ <option name="LAST_RESOLUTION" value="IGNORE" />
10
+ </component>
11
+ <component name="CoverageDataManager">
12
+ <SUITE FILE_PATH="coverage/share_link@share_link.rcov" NAME="share_link Coverage Results" MODIFIED="1545978125762" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib" MODULE_NAME="share-link" />
13
+ </component>
14
+ <component name="FileEditorManager">
15
+ <leaf>
16
+ <file pinned="false" current-in-tab="false">
17
+ <entry file="file://$PROJECT_DIR$/lib/jwt_manager.rb">
18
+ <provider selected="true" editor-type-id="text-editor">
19
+ <state relative-caret-position="115">
20
+ <caret line="5" column="4" selection-start-line="5" selection-start-column="4" selection-end-line="5" selection-end-column="4" />
21
+ </state>
22
+ </provider>
23
+ </entry>
24
+ </file>
25
+ <file pinned="false" current-in-tab="false">
26
+ <entry file="file://$PROJECT_DIR$/lib/token_decoder.rb">
27
+ <provider selected="true" editor-type-id="text-editor">
28
+ <state>
29
+ <caret column="8" selection-start-column="8" selection-end-column="8" />
30
+ </state>
31
+ </provider>
32
+ </entry>
33
+ </file>
34
+ <file pinned="false" current-in-tab="false">
35
+ <entry file="file://$PROJECT_DIR$/share-link.gemspec">
36
+ <provider selected="true" editor-type-id="text-editor">
37
+ <state relative-caret-position="302">
38
+ <caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
39
+ </state>
40
+ </provider>
41
+ </entry>
42
+ </file>
43
+ <file pinned="false" current-in-tab="true">
44
+ <entry file="file://$PROJECT_DIR$/lib/share_link.rb">
45
+ <provider selected="true" editor-type-id="text-editor">
46
+ <state relative-caret-position="312">
47
+ <caret line="12" column="10" selection-start-line="12" selection-start-column="10" selection-end-line="12" selection-end-column="10" />
48
+ </state>
49
+ </provider>
50
+ </entry>
51
+ </file>
52
+ <file pinned="false" current-in-tab="false">
53
+ <entry file="file://$PROJECT_DIR$/lib/link_generator.rb">
54
+ <provider selected="true" editor-type-id="text-editor">
55
+ <state>
56
+ <caret column="9" selection-start-column="9" selection-end-column="9" />
57
+ </state>
58
+ </provider>
59
+ </entry>
60
+ </file>
61
+ <file pinned="false" current-in-tab="false">
62
+ <entry file="file://$PROJECT_DIR$/spec/share_link/token_decoder_spec.rb">
63
+ <provider selected="true" editor-type-id="text-editor">
64
+ <state relative-caret-position="207">
65
+ <caret line="9" selection-start-line="9" selection-end-line="9" />
66
+ </state>
67
+ </provider>
68
+ </entry>
69
+ </file>
70
+ <file pinned="false" current-in-tab="false">
71
+ <entry file="file://$PROJECT_DIR$/spec/share_link/link_generator_spec.rb">
72
+ <provider selected="true" editor-type-id="text-editor">
73
+ <state relative-caret-position="184">
74
+ <caret line="8" column="22" selection-start-line="8" selection-start-column="22" selection-end-line="8" selection-end-column="22" />
75
+ </state>
76
+ </provider>
77
+ </entry>
78
+ </file>
79
+ </leaf>
80
+ </component>
81
+ <component name="FileTemplateManagerImpl">
82
+ <option name="RECENT_TEMPLATES">
83
+ <list>
84
+ <option value="Ruby Class Template" />
85
+ </list>
86
+ </option>
87
+ </component>
88
+ <component name="FindInProjectRecents">
89
+ <findStrings>
90
+ <find>bye</find>
91
+ <find>ShareLink</find>
92
+ <find>allowed</find>
93
+ </findStrings>
94
+ <replaceStrings>
95
+ <replace />
96
+ </replaceStrings>
97
+ </component>
98
+ <component name="Git.Settings">
99
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
100
+ </component>
101
+ <component name="IdeDocumentHistory">
102
+ <option name="CHANGED_PATHS">
103
+ <list>
104
+ <option value="$PROJECT_DIR$/lib/jwt_manager.rb" />
105
+ <option value="$PROJECT_DIR$/lib/share_link/token_decoder.rb" />
106
+ <option value="$PROJECT_DIR$/lib/token_decoder.rb" />
107
+ <option value="$PROJECT_DIR$/spec/share_link/generator_spec.rb" />
108
+ <option value="$PROJECT_DIR$/spec/share_link/token_decoder_spec.rb" />
109
+ <option value="$PROJECT_DIR$/spec/share_link/link_generator_spec.rb" />
110
+ <option value="$PROJECT_DIR$/lib/link_generator.rb" />
111
+ <option value="$PROJECT_DIR$/lib/share_link.rb" />
112
+ <option value="$PROJECT_DIR$/share-link.gemspec" />
113
+ </list>
114
+ </option>
115
+ </component>
116
+ <component name="ProjectFrameBounds" extendedState="6">
117
+ <option name="y" value="23" />
118
+ <option name="width" value="1680" />
119
+ <option name="height" value="1027" />
120
+ </component>
121
+ <component name="ProjectView">
122
+ <navigator proportions="" version="1">
123
+ <foldersAlwaysOnTop value="true" />
124
+ </navigator>
125
+ <panes>
126
+ <pane id="ProjectPane">
127
+ <subPane>
128
+ <expand>
129
+ <path>
130
+ <item name="share-link" type="b2602c69:ProjectViewProjectNode" />
131
+ <item name="share-link" type="462c0819:PsiDirectoryNode" />
132
+ </path>
133
+ <path>
134
+ <item name="share-link" type="b2602c69:ProjectViewProjectNode" />
135
+ <item name="share-link" type="462c0819:PsiDirectoryNode" />
136
+ <item name="lib" type="462c0819:PsiDirectoryNode" />
137
+ </path>
138
+ </expand>
139
+ <select />
140
+ </subPane>
141
+ </pane>
142
+ <pane id="Scope" />
143
+ </panes>
144
+ </component>
145
+ <component name="PropertiesComponent">
146
+ <property name="WebServerToolWindowFactoryState" value="false" />
147
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
148
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
149
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
150
+ <property name="run.code.analysis.last.selected.profile" value="pProject Default" />
151
+ </component>
152
+ <component name="RecentsManager">
153
+ <key name="MoveFile.RECENT_KEYS">
154
+ <recent name="$PROJECT_DIR$/lib" />
155
+ </key>
156
+ </component>
157
+ <component name="RunDashboard">
158
+ <option name="ruleStates">
159
+ <list>
160
+ <RuleState>
161
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
162
+ </RuleState>
163
+ <RuleState>
164
+ <option name="name" value="StatusDashboardGroupingRule" />
165
+ </RuleState>
166
+ </list>
167
+ </option>
168
+ </component>
169
+ <component name="RunManager">
170
+ <configuration name="share_link" type="RubyRunConfigurationType" factoryName="Ruby" temporary="true">
171
+ <module name="share-link" />
172
+ <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
173
+ <RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/lib" />
174
+ <RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
175
+ <RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
176
+ <RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
177
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
178
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
179
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
180
+ <COVERAGE_PATTERN ENABLED="true">
181
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
182
+ </COVERAGE_PATTERN>
183
+ </EXTENSION>
184
+ <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/lib/share_link.rb" />
185
+ <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
186
+ <method v="2" />
187
+ </configuration>
188
+ <recent_temporary>
189
+ <list>
190
+ <item itemvalue="Ruby.share_link" />
191
+ </list>
192
+ </recent_temporary>
193
+ </component>
194
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
195
+ <component name="SvnConfiguration">
196
+ <configuration />
197
+ </component>
198
+ <component name="TaskManager">
199
+ <task active="true" id="Default" summary="Default task">
200
+ <changelist id="7fba77f7-fc22-4f2a-a2bc-71653b21e7d0" name="Default Changelist" comment="" />
201
+ <created>1545973486623</created>
202
+ <option name="number" value="Default" />
203
+ <option name="presentableId" value="Default" />
204
+ <updated>1545973486623</updated>
205
+ <workItem from="1545973487909" duration="4493000" />
206
+ </task>
207
+ <servers />
208
+ </component>
209
+ <component name="TimeTrackingManager">
210
+ <option name="totallyTimeSpent" value="4493000" />
211
+ </component>
212
+ <component name="ToolWindowManager">
213
+ <frame x="0" y="23" width="1680" height="1027" extended-state="6" />
214
+ <editor active="true" />
215
+ <layout>
216
+ <window_info id="Favorites" side_tool="true" />
217
+ <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24969475" />
218
+ <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
219
+ <window_info anchor="bottom" id="Docker" show_stripe_button="false" />
220
+ <window_info anchor="bottom" id="Database Changes" />
221
+ <window_info anchor="bottom" id="Version Control" />
222
+ <window_info anchor="bottom" id="Inspection Results" weight="0.3297062" />
223
+ <window_info anchor="bottom" id="Messages" weight="0.3297062" />
224
+ <window_info anchor="bottom" id="Terminal" weight="0.3297062" />
225
+ <window_info anchor="bottom" id="Event Log" side_tool="true" />
226
+ <window_info anchor="bottom" id="Message" order="0" />
227
+ <window_info anchor="bottom" id="Find" order="1" weight="0.3297062" />
228
+ <window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.3297062" />
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="right" id="Database" />
234
+ <window_info anchor="right" id="Commander" order="0" weight="0.4" />
235
+ <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
236
+ <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
237
+ </layout>
238
+ </component>
239
+ <component name="TypeScriptGeneratedFilesManager">
240
+ <option name="version" value="1" />
241
+ </component>
242
+ <component name="editorHistoryManager">
243
+ <entry file="file://$PROJECT_DIR$/spec/share_link/link_generator_spec.rb">
244
+ <provider selected="true" editor-type-id="text-editor">
245
+ <state relative-caret-position="184">
246
+ <caret line="8" column="22" selection-start-line="8" selection-start-column="22" selection-end-line="8" selection-end-column="22" />
247
+ </state>
248
+ </provider>
249
+ </entry>
250
+ <entry file="file://$PROJECT_DIR$/lib/jwt_manager.rb">
251
+ <provider selected="true" editor-type-id="text-editor">
252
+ <state relative-caret-position="115">
253
+ <caret line="5" column="4" selection-start-line="5" selection-start-column="4" selection-end-line="5" selection-end-column="4" />
254
+ </state>
255
+ </provider>
256
+ </entry>
257
+ <entry file="file://$PROJECT_DIR$/lib/link_generator.rb">
258
+ <provider selected="true" editor-type-id="text-editor">
259
+ <state>
260
+ <caret column="9" selection-start-column="9" selection-end-column="9" />
261
+ </state>
262
+ </provider>
263
+ </entry>
264
+ <entry file="file://$PROJECT_DIR$/lib/token_decoder.rb">
265
+ <provider selected="true" editor-type-id="text-editor">
266
+ <state>
267
+ <caret column="8" selection-start-column="8" selection-end-column="8" />
268
+ </state>
269
+ </provider>
270
+ </entry>
271
+ <entry file="file://$PROJECT_DIR$/spec/share_link/token_decoder_spec.rb">
272
+ <provider selected="true" editor-type-id="text-editor">
273
+ <state relative-caret-position="207">
274
+ <caret line="9" selection-start-line="9" selection-end-line="9" />
275
+ </state>
276
+ </provider>
277
+ </entry>
278
+ <entry file="file://$PROJECT_DIR$/share-link.gemspec">
279
+ <provider selected="true" editor-type-id="text-editor">
280
+ <state relative-caret-position="302">
281
+ <caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
282
+ </state>
283
+ </provider>
284
+ </entry>
285
+ <entry file="file://$PROJECT_DIR$/lib/share_link.rb">
286
+ <provider selected="true" editor-type-id="text-editor">
287
+ <state relative-caret-position="312">
288
+ <caret line="12" column="10" selection-start-line="12" selection-start-column="10" selection-end-line="12" selection-end-column="10" />
289
+ </state>
290
+ </provider>
291
+ </entry>
292
+ </component>
293
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.7
7
+ before_install: gem install bundler -v 1.17.1
@@ -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 Jacob.Abraham@shopify.com. 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
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in share-link.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ share-link (2.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (5.2.2)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ concurrent-ruby (1.1.4)
15
+ diff-lcs (1.3)
16
+ i18n (1.3.0)
17
+ concurrent-ruby (~> 1.0)
18
+ jwt (2.1.0)
19
+ minitest (5.11.3)
20
+ rake (10.5.0)
21
+ rspec (3.8.0)
22
+ rspec-core (~> 3.8.0)
23
+ rspec-expectations (~> 3.8.0)
24
+ rspec-mocks (~> 3.8.0)
25
+ rspec-core (3.8.0)
26
+ rspec-support (~> 3.8.0)
27
+ rspec-expectations (3.8.2)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.8.0)
30
+ rspec-mocks (3.8.0)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.8.0)
33
+ rspec-support (3.8.0)
34
+ thread_safe (0.3.6)
35
+ tzinfo (1.2.5)
36
+ thread_safe (~> 0.1)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ activesupport (~> 5.0)
43
+ bundler (~> 1.17)
44
+ jwt
45
+ rake (~> 10.0)
46
+ rspec
47
+ share-link!
48
+
49
+ BUNDLED WITH
50
+ 1.17.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Jacob Abraham
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,43 @@
1
+ # Share::Link
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/share/link`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'share-link'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install share-link
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/share-link. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Share::Link project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/share-link/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.warning = true
8
+ t.test_files = FileList["test/**/*_test.rb"]
9
+ end
10
+
11
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "share/link"
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,12 @@
1
+ require 'jwt'
2
+ class JWTManager
3
+
4
+ def self.encode(payload)
5
+ full_payload = { data: payload }
6
+ JWT.encode(full_payload, nil, 'none')
7
+ end
8
+
9
+ def self.decode(jwt)
10
+ JWT.decode(jwt, nil, false).first["data"]
11
+ end
12
+ end
@@ -0,0 +1,34 @@
1
+ require 'token_storage.rb'
2
+ require 'securerandom'
3
+ require 'jwt_manager'
4
+ class LinkGenerator
5
+ attr_reader :payload, :base_url, :token_store
6
+
7
+ def initialize(params)
8
+ @base_url = params[:base_url]
9
+ @payload = params[:payload]
10
+ @token_store = TokenStorage.new
11
+ end
12
+
13
+ def generate_link
14
+ save_jwt
15
+ "www.#{base_url}/#{link_token}"
16
+ end
17
+
18
+
19
+ private
20
+
21
+ def link_token
22
+ @link_token ||= SecureRandom.hex(5)
23
+ end
24
+
25
+ def save_jwt
26
+ token_store.save(link_token, jwt_token)
27
+ end
28
+
29
+
30
+ def jwt_token
31
+ JWTManager.encode(payload)
32
+ end
33
+ end
34
+
data/lib/share_link.rb ADDED
@@ -0,0 +1,6 @@
1
+ class ShareLink
2
+ require 'link_generator'
3
+ require 'token_decoder'
4
+ require 'token_storage'
5
+ require 'jwt_manager'
6
+ end
@@ -0,0 +1,25 @@
1
+ require 'jwt_manager'
2
+ require 'token_storage'
3
+
4
+ class TokenDecoder
5
+ attr_reader :token
6
+
7
+ def initialize(token)
8
+ @token = token
9
+ end
10
+
11
+ def decode
12
+ jwt = load_jwt_from_link
13
+ decrypted_jwt(jwt)
14
+ end
15
+
16
+ private
17
+
18
+ def load_jwt_from_link
19
+ TokenStorage.new.load(token)
20
+ end
21
+
22
+ def decrypted_jwt(jwt)
23
+ JWTManager.decode(jwt)
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ require 'pstore'
2
+ class TokenStorage
3
+ attr_reader :ptoken
4
+
5
+ def initialize
6
+ @ptoken = PStore.new('token_store.pstore')
7
+ end
8
+
9
+ def save(link_token, jwt_token)
10
+ ptoken.transaction do |s|
11
+ s[link_token] = jwt_token
12
+ end
13
+ return true
14
+ rescue
15
+ return false
16
+ end
17
+
18
+ def load(token)
19
+ data = nil
20
+ read_only = true
21
+ ptoken.transaction(read_only) do |s|
22
+ return nil if s[token].nil?
23
+ data = s[token]
24
+ end
25
+ data
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "share-link"
7
+ spec.version = '2.3'
8
+ spec.authors = ["Jacob Abraham"]
9
+ spec.email = ["jacobabraham0429@gmail.com"]
10
+
11
+ spec.summary = %q{ Create shareable links}
12
+ spec.homepage = "https://github.com/JacobAbrahamShopify/shareable-link.git"
13
+ spec.license = "MIT"
14
+
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.bindir = "exe"
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.17"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "jwt"
30
+ spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "activesupport", "~> 5.0"
32
+ end
Binary file
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: share-link
3
+ version: !ruby/object:Gem::Version
4
+ version: '2.3'
5
+ platform: ruby
6
+ authors:
7
+ - Jacob Abraham
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: jwt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
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
+ - jacobabraham0429@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".byebug_history"
91
+ - ".gitignore"
92
+ - ".idea/.rakeTasks"
93
+ - ".idea/encodings.xml"
94
+ - ".idea/inspectionProfiles/Project_Default.xml"
95
+ - ".idea/misc.xml"
96
+ - ".idea/modules.xml"
97
+ - ".idea/share-link.iml"
98
+ - ".idea/vcs.xml"
99
+ - ".idea/workspace.xml"
100
+ - ".rspec"
101
+ - ".travis.yml"
102
+ - CODE_OF_CONDUCT.md
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - LICENSE.txt
106
+ - README.md
107
+ - Rakefile
108
+ - bin/console
109
+ - bin/setup
110
+ - lib/jwt_manager.rb
111
+ - lib/link_generator.rb
112
+ - lib/share_link.rb
113
+ - lib/token_decoder.rb
114
+ - lib/token_storage.rb
115
+ - share-link.gemspec
116
+ - token_store.pstore
117
+ homepage: https://github.com/JacobAbrahamShopify/shareable-link.git
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.5.2.3
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Create shareable links
141
+ test_files: []