socketlabs-injectionapi 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/socketlabs-ruby.iml +1 -1
- data/.idea/workspace.xml +12 -114
- data/README.MD +5 -0
- data/gemfile.lock +1 -1
- data/lib/socketlabs-injectionapi.rb +2 -0
- data/lib/socketlabs/injectionapi/core/http_request.rb +10 -2
- data/lib/socketlabs/injectionapi/core/retryhandler.rb +68 -0
- data/lib/socketlabs/injectionapi/retrysettings.rb +61 -0
- data/lib/socketlabs/injectionapi/socketlabsclient.rb +25 -6
- data/lib/socketlabs/version.rb +1 -1
- data/socketlabs-injectionapi.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fce0b211f96b88503365f93ed1270eb5d943d835e21e53fcbee2806621354f0
|
4
|
+
data.tar.gz: bae74a7c4e920b89fdea11aaed1efce1166ccd9ff923ef39f9e04278118eed06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8004fdece9672ae94d3f3fef5838504cb65606f21ff656210a7a91741b0ec713aecc56bcd0926864e5524dc75869bca3914fc98f3f3f9be808243fb859c035e0
|
7
|
+
data.tar.gz: 8a7114b59e0f8ec6c8ad416b30743d346cccd9de03c84a0b2380bf14885a25a7a0d146f7be6017a92dae2af381b8a339dfe442e128a74f67042801274a0b18b5
|
data/.idea/socketlabs-ruby.iml
CHANGED
@@ -7,6 +7,6 @@
|
|
7
7
|
<content url="file://$MODULE_DIR$" />
|
8
8
|
<orderEntry type="jdk" jdkName="ruby-2.6.6-p146" jdkType="RUBY_SDK" />
|
9
9
|
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, ruby-2.6.6-p146) [gem]" level="application" />
|
11
11
|
</component>
|
12
12
|
</module>
|
data/.idea/workspace.xml
CHANGED
@@ -3,28 +3,12 @@
|
|
3
3
|
<component name="AnalysisUIOptions">
|
4
4
|
<option name="SCOPE_TYPE" value="3" />
|
5
5
|
</component>
|
6
|
-
<component name="BranchesTreeState">
|
7
|
-
<expand>
|
8
|
-
<path>
|
9
|
-
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
10
|
-
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
11
|
-
</path>
|
12
|
-
<path>
|
13
|
-
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
14
|
-
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
15
|
-
</path>
|
16
|
-
<path>
|
17
|
-
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
18
|
-
<item name="REMOTE_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
19
|
-
<item name="GROUP_NODE:origin" type="e8cecc67:BranchNodeDescriptor" />
|
20
|
-
</path>
|
21
|
-
</expand>
|
22
|
-
<select />
|
23
|
-
</component>
|
24
6
|
<component name="ChangeListManager">
|
25
7
|
<list default="true" id="85d88e06-b233-47b5-8542-3cede01dcf1c" name="Default Changelist" comment="">
|
26
|
-
<change beforePath="$PROJECT_DIR$/.idea/socketlabs-ruby.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/socketlabs-ruby.iml" afterDir="false" />
|
27
8
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
9
|
+
<change beforePath="$PROJECT_DIR$/README.MD" beforeDir="false" afterPath="$PROJECT_DIR$/README.MD" afterDir="false" />
|
10
|
+
<change beforePath="$PROJECT_DIR$/gemfile.lock" beforeDir="false" afterPath="$PROJECT_DIR$/gemfile.lock" afterDir="false" />
|
11
|
+
<change beforePath="$PROJECT_DIR$/lib/socketlabs/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/socketlabs/version.rb" afterDir="false" />
|
28
12
|
</list>
|
29
13
|
<option name="SHOW_DIALOG" value="false" />
|
30
14
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
@@ -80,8 +64,7 @@
|
|
80
64
|
<component name="PropertiesComponent">
|
81
65
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
82
66
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
83
|
-
<property name="last_opened_file_path" value="$PROJECT_DIR$/examples/bulk
|
84
|
-
<property name="nodejs_package_manager_path" value="npm" />
|
67
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$/examples/bulk" />
|
85
68
|
<property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
|
86
69
|
</component>
|
87
70
|
<component name="RecentsManager">
|
@@ -150,21 +133,6 @@
|
|
150
133
|
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
151
134
|
<method v="2" />
|
152
135
|
</configuration>
|
153
|
-
<configuration name="basic_send_with_amp_body" type="RubyRunConfigurationType" factoryName="Ruby">
|
154
|
-
<module name="socketlabs-ruby" />
|
155
|
-
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
|
156
|
-
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/examples/basic" />
|
157
|
-
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
158
|
-
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="ruby-2.7.1-p83" />
|
159
|
-
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
160
|
-
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
161
|
-
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
162
|
-
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
163
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
|
164
|
-
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/examples/basic/basic_send_with_amp_body.rb" />
|
165
|
-
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
166
|
-
<method v="2" />
|
167
|
-
</configuration>
|
168
136
|
<configuration name="basic_send_with_api_template" type="RubyRunConfigurationType" factoryName="Ruby">
|
169
137
|
<module name="socketlabs-ruby" />
|
170
138
|
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
|
@@ -175,7 +143,6 @@
|
|
175
143
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
176
144
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
177
145
|
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
178
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
|
179
146
|
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/examples/basic/basic_send_with_api_template.rb" />
|
180
147
|
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
181
148
|
<method v="2" />
|
@@ -190,7 +157,6 @@
|
|
190
157
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
191
158
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
192
159
|
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
193
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
|
194
160
|
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/examples/basic/basic_send_with_ascii_charset.rb" />
|
195
161
|
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
196
162
|
<method v="2" />
|
@@ -289,26 +255,10 @@
|
|
289
255
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
290
256
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
291
257
|
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
292
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
|
293
258
|
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/examples/bulk/bulk_send_from_data_source_with_merge_data.rb" />
|
294
259
|
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
295
260
|
<method v="2" />
|
296
261
|
</configuration>
|
297
|
-
<configuration name="bulk_send_with_amp_body" type="RubyRunConfigurationType" factoryName="Ruby">
|
298
|
-
<module name="socketlabs-ruby" />
|
299
|
-
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
|
300
|
-
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$/examples/bulk/" />
|
301
|
-
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
302
|
-
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
303
|
-
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
304
|
-
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
305
|
-
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
306
|
-
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
307
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
|
308
|
-
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/examples/bulk/bulk_send_with_amp_body.rb" />
|
309
|
-
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
310
|
-
<method v="2" />
|
311
|
-
</configuration>
|
312
262
|
<configuration name="bulk_send_with_ascii_charset_merge_data" type="RubyRunConfigurationType" factoryName="Ruby">
|
313
263
|
<module name="socketlabs-ruby" />
|
314
264
|
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
|
@@ -347,7 +297,6 @@
|
|
347
297
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
348
298
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
349
299
|
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
|
350
|
-
<EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
|
351
300
|
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$MODULE_DIR$/examples/example_code.rb" />
|
352
301
|
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
353
302
|
<method v="2" />
|
@@ -357,7 +306,6 @@
|
|
357
306
|
<item itemvalue="Ruby.basic_send_complex" />
|
358
307
|
<item itemvalue="Ruby.basic_send_from_html_file" />
|
359
308
|
<item itemvalue="Ruby.basic_send_with_api_template" />
|
360
|
-
<item itemvalue="Ruby.basic_send_with_amp_body" />
|
361
309
|
<item itemvalue="Ruby.basic_send_with_ascii_charset" />
|
362
310
|
<item itemvalue="Ruby.basic_send_with_attachment" />
|
363
311
|
<item itemvalue="Ruby.basic_send_with_custom_headers" />
|
@@ -365,9 +313,8 @@
|
|
365
313
|
<item itemvalue="Ruby.basic_send_with_proxy" />
|
366
314
|
<item itemvalue="Ruby.bulk_send" />
|
367
315
|
<item itemvalue="Ruby.bulk_send_complex" />
|
368
|
-
<item itemvalue="Ruby.bulk_send_with_ascii_charset_merge_data" />
|
369
316
|
<item itemvalue="Ruby.bulk_send_from_data_source_with_merge_data" />
|
370
|
-
<item itemvalue="Ruby.
|
317
|
+
<item itemvalue="Ruby.bulk_send_with_ascii_charset_merge_data" />
|
371
318
|
<item itemvalue="Ruby.bulk_send_with_merge_data" />
|
372
319
|
<item itemvalue="Ruby.example_code" />
|
373
320
|
</list>
|
@@ -413,65 +360,28 @@
|
|
413
360
|
<option name="version" value="3" />
|
414
361
|
</component>
|
415
362
|
<component name="Vcs.Log.Tabs.Properties">
|
416
|
-
<option name="
|
417
|
-
<map>
|
418
|
-
<entry key="MAIN">
|
419
|
-
<value>
|
420
|
-
<State />
|
421
|
-
</value>
|
422
|
-
</entry>
|
423
|
-
</map>
|
424
|
-
</option>
|
363
|
+
<option name="oldMeFiltersMigrated" value="true" />
|
425
364
|
</component>
|
426
365
|
<component name="WindowStateProjectService">
|
427
|
-
<state
|
366
|
+
<state width="1493" height="160" key="GridCell.Tab.0.bottom" timestamp="1596574157638">
|
428
367
|
<screen x="0" y="0" width="1536" height="824" />
|
429
368
|
</state>
|
430
|
-
<state x="223" y="0" width="1089" height="824" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598376897932" />
|
431
|
-
<state x="548" y="167" key="FileChooserDialogImpl" timestamp="1598376734084">
|
432
|
-
<screen x="0" y="0" width="1536" height="824" />
|
433
|
-
</state>
|
434
|
-
<state x="548" y="167" key="FileChooserDialogImpl/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598376734084" />
|
435
|
-
<state width="1493" height="261" key="GridCell.Tab.0.bottom" timestamp="1598377144504">
|
436
|
-
<screen x="0" y="0" width="1536" height="824" />
|
437
|
-
</state>
|
438
|
-
<state width="1493" height="261" key="GridCell.Tab.0.bottom/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144504" />
|
439
369
|
<state width="1493" height="160" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1596574157638" />
|
440
|
-
<state width="1493" height="
|
370
|
+
<state width="1493" height="160" key="GridCell.Tab.0.center" timestamp="1596574157638">
|
441
371
|
<screen x="0" y="0" width="1536" height="824" />
|
442
372
|
</state>
|
443
|
-
<state width="1493" height="261" key="GridCell.Tab.0.center/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144504" />
|
444
373
|
<state width="1493" height="160" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1596574157638" />
|
445
|
-
<state width="1493" height="
|
374
|
+
<state width="1493" height="160" key="GridCell.Tab.0.left" timestamp="1596574157638">
|
446
375
|
<screen x="0" y="0" width="1536" height="824" />
|
447
376
|
</state>
|
448
|
-
<state width="1493" height="261" key="GridCell.Tab.0.left/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144503" />
|
449
377
|
<state width="1493" height="160" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1596574157638" />
|
450
|
-
<state width="1493" height="
|
378
|
+
<state width="1493" height="160" key="GridCell.Tab.0.right" timestamp="1596574157638">
|
451
379
|
<screen x="0" y="0" width="1536" height="824" />
|
452
380
|
</state>
|
453
|
-
<state width="1493" height="261" key="GridCell.Tab.0.right/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144504" />
|
454
381
|
<state width="1493" height="160" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1596574157638" />
|
455
|
-
<state
|
456
|
-
<screen x="0" y="0" width="1536" height="824" />
|
457
|
-
</state>
|
458
|
-
<state width="1493" height="261" key="GridCell.Tab.1.bottom/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144505" />
|
459
|
-
<state width="1493" height="261" key="GridCell.Tab.1.center" timestamp="1598377144505">
|
460
|
-
<screen x="0" y="0" width="1536" height="824" />
|
461
|
-
</state>
|
462
|
-
<state width="1493" height="261" key="GridCell.Tab.1.center/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144505" />
|
463
|
-
<state width="1493" height="261" key="GridCell.Tab.1.left" timestamp="1598377144505">
|
464
|
-
<screen x="0" y="0" width="1536" height="824" />
|
465
|
-
</state>
|
466
|
-
<state width="1493" height="261" key="GridCell.Tab.1.left/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144505" />
|
467
|
-
<state width="1493" height="261" key="GridCell.Tab.1.right" timestamp="1598377144505">
|
468
|
-
<screen x="0" y="0" width="1536" height="824" />
|
469
|
-
</state>
|
470
|
-
<state width="1493" height="261" key="GridCell.Tab.1.right/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598377144505" />
|
471
|
-
<state x="278" y="58" key="SettingsEditor" timestamp="1598376867375">
|
382
|
+
<state x="278" y="58" key="SettingsEditor" timestamp="1596568157811">
|
472
383
|
<screen x="0" y="0" width="1536" height="824" />
|
473
384
|
</state>
|
474
|
-
<state x="278" y="58" key="SettingsEditor/0.0.1536.824/-1920.6.1536.824@0.0.1536.824" timestamp="1598376867375" />
|
475
385
|
<state x="278" y="58" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1596568157811" />
|
476
386
|
<state x="222" y="11" width="1116" height="801" key="find.popup" timestamp="1596633144560">
|
477
387
|
<screen x="0" y="0" width="1536" height="824" />
|
@@ -479,18 +389,6 @@
|
|
479
389
|
<state x="222" y="11" width="1116" height="801" key="find.popup/0.0.1536.824@0.0.1536.824" timestamp="1596633144560" />
|
480
390
|
</component>
|
481
391
|
<component name="XDebuggerManager">
|
482
|
-
<breakpoint-manager>
|
483
|
-
<breakpoints>
|
484
|
-
<line-breakpoint enabled="true" type="ruby-line">
|
485
|
-
<url>file://$PROJECT_DIR$/examples/basic/basic_send_with_amp_body.rb</url>
|
486
|
-
<line>10</line>
|
487
|
-
<properties myBlockOrdinal="-1">
|
488
|
-
<option name="block-ordinal" value="-1" />
|
489
|
-
</properties>
|
490
|
-
<option name="timeStamp" value="1" />
|
491
|
-
</line-breakpoint>
|
492
|
-
</breakpoints>
|
493
|
-
</breakpoint-manager>
|
494
392
|
<watches-manager>
|
495
393
|
<configuration name="RubyRunConfigurationType">
|
496
394
|
<watch expression="@body" />
|
@@ -509,7 +407,7 @@
|
|
509
407
|
<SUITE FILE_PATH="coverage/socketlabs_ruby@basic_send_with_embedded_image.rcov" NAME="basic_send_with_embedded_image Coverage Results" MODIFIED="1579790668047" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/basic" MODULE_NAME="socketlabs-ruby" />
|
510
408
|
<SUITE FILE_PATH="coverage/socketlabs_ruby@basic_send.rcov" NAME="basic_send Coverage Results" MODIFIED="1579800210587" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/basic" MODULE_NAME="socketlabs-ruby" />
|
511
409
|
<SUITE FILE_PATH="coverage/socketlabs_ruby@basic_send_with_api_template.rcov" NAME="basic_send_with_api_template Coverage Results" MODIFIED="1579790803165" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/basic" MODULE_NAME="socketlabs-ruby" />
|
512
|
-
<SUITE FILE_PATH="coverage/socketlabs_ruby@example_code.rcov" NAME="example_code Coverage Results" MODIFIED="
|
410
|
+
<SUITE FILE_PATH="coverage/socketlabs_ruby@example_code.rcov" NAME="example_code Coverage Results" MODIFIED="1618319668269" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/bulk/" MODULE_NAME="socketlabs-ruby" />
|
513
411
|
<SUITE FILE_PATH="coverage/socketlabs_ruby@bulk_send.rcov" NAME="bulk_send Coverage Results" MODIFIED="1580217378528" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/bulk/" MODULE_NAME="socketlabs-ruby" />
|
514
412
|
<SUITE FILE_PATH="coverage/socketlabs_ruby@bulk_send_with_ascii_charset_merge_data.rcov" NAME="bulk_send_with_ascii_charset_merge_data Coverage Results" MODIFIED="1580218733739" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/bulk/" MODULE_NAME="socketlabs-ruby" />
|
515
413
|
<SUITE FILE_PATH="coverage/socketlabs_ruby@basic_send_from_html_file.rcov" NAME="basic_send_from_html_file Coverage Results" MODIFIED="1579791581439" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples/basic" MODULE_NAME="socketlabs-ruby" />
|
data/README.MD
CHANGED
@@ -175,6 +175,9 @@ This example demonstrates how to embed an image in your message.
|
|
175
175
|
### [Basic send with a web proxy](https://github.com/socketlabs/socketlabs-ruby/blob/master/examples/basic/basic_send_with_proxy.rb)
|
176
176
|
This example demonstrates how to use a proxy with your HTTP client.
|
177
177
|
|
178
|
+
### [Basic send with retry enabled](https://github.com/socketlabs/socketlabs-ruby/blob/master/examples/basic/basic_send_with_retry.rb)
|
179
|
+
This example demonstrates how to use the retry logic with your HTTP client.
|
180
|
+
|
178
181
|
### [Basic send with Amp ](https://github.com/socketlabs/socketlabs-ruby/blob/master/examples/basic/basic_send_with_amp_body.rb)
|
179
182
|
This example demonstrates how to send a basic message with an AMP Html body.
|
180
183
|
For more information about AMP please see [AMP Project](https://amp.dev/documentation/)
|
@@ -213,6 +216,8 @@ For more information about AMP please see [AMP Project](https://amp.dev/document
|
|
213
216
|
|
214
217
|
<a name="version"></a>
|
215
218
|
# Version
|
219
|
+
* 1.2.1 - Adding optional retry logic for Http requests. If configured, the request will retry when certain 500 errors occur (500, 502, 503, 504)
|
220
|
+
* 1.1.1 - Adding request timeout value on the client for Http requests
|
216
221
|
* 1.1.0 - Adds Amp Html Support
|
217
222
|
* 1.0.0 - Initial Release
|
218
223
|
|
data/gemfile.lock
CHANGED
@@ -5,6 +5,7 @@ require_relative 'socketlabs/injectionapi/proxy'
|
|
5
5
|
require_relative 'socketlabs/injectionapi/send_response'
|
6
6
|
require_relative 'socketlabs/injectionapi/send_result'
|
7
7
|
require_relative 'socketlabs/injectionapi/socketlabsclient'
|
8
|
+
require_relative 'socketlabs/injectionapi/retrysettings'
|
8
9
|
require_relative 'socketlabs/injectionapi/message/attachment'
|
9
10
|
require_relative 'socketlabs/injectionapi/message/message_base'
|
10
11
|
require_relative 'socketlabs/injectionapi/message/basic_message'
|
@@ -24,4 +25,5 @@ require_relative 'socketlabs/injectionapi/core/serialization/message_json'
|
|
24
25
|
require_relative 'socketlabs/injectionapi/core/serialization/message_result_dto'
|
25
26
|
require_relative 'socketlabs/injectionapi/core/injection_request_factory'
|
26
27
|
require_relative 'socketlabs/injectionapi/core/http_request'
|
28
|
+
require_relative 'socketlabs/injectionapi/core/retryhandler'
|
27
29
|
require_relative 'socketlabs/injectionapi/core/http_response'
|
@@ -28,6 +28,8 @@ module SocketLabs
|
|
28
28
|
attr_reader :proxy
|
29
29
|
# The Net::HTTP used when making the HTTP request
|
30
30
|
attr_reader :http
|
31
|
+
# The Timeout to use when making the HTTP request
|
32
|
+
attr_reader :timeout
|
31
33
|
|
32
34
|
# @param [Hash] http_request_method
|
33
35
|
# @param [Hash] arguments:
|
@@ -40,6 +42,7 @@ module SocketLabs
|
|
40
42
|
@request_method = http_request_method
|
41
43
|
@endpoint = "https://inject.socketlabs.com/api/v1/email"
|
42
44
|
@proxy = Array.new
|
45
|
+
@timeout = 120
|
43
46
|
|
44
47
|
unless arguments.nil? || arguments.empty?
|
45
48
|
|
@@ -51,6 +54,10 @@ module SocketLabs
|
|
51
54
|
@proxy = arguments[:proxy]
|
52
55
|
end
|
53
56
|
|
57
|
+
unless arguments[:timeout].nil?
|
58
|
+
@timeout = arguments[:timeout]
|
59
|
+
end
|
60
|
+
|
54
61
|
end
|
55
62
|
|
56
63
|
@http = nil
|
@@ -68,8 +75,7 @@ module SocketLabs
|
|
68
75
|
response = @http.request(@request)
|
69
76
|
http_response = HttpResponse.new(response)
|
70
77
|
|
71
|
-
|
72
|
-
parser.parse(http_response)
|
78
|
+
http_response
|
73
79
|
|
74
80
|
end
|
75
81
|
|
@@ -112,6 +118,8 @@ module SocketLabs
|
|
112
118
|
params += @proxy.values_at(:host, :port, :user, :pass) unless @proxy.empty?
|
113
119
|
|
114
120
|
@http = Net::HTTP.new(*params)
|
121
|
+
# add timeout
|
122
|
+
@http.read_timeout = @timeout
|
115
123
|
# add ssl
|
116
124
|
if @endpoint.start_with?('https')
|
117
125
|
@http.use_ssl = true
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative '../../version.rb'
|
2
|
+
require_relative '../retrysettings.rb'
|
3
|
+
require_relative 'injection_response_parser'
|
4
|
+
|
5
|
+
module SocketLabs
|
6
|
+
module InjectionApi
|
7
|
+
module Core
|
8
|
+
class RetryHandler
|
9
|
+
# include SocketLabsClient::InjectionApi
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
attr_accessor :http_client
|
14
|
+
attr_accessor :endpoint_url
|
15
|
+
attr_accessor :retry_settings
|
16
|
+
attr_accessor :error_codes
|
17
|
+
|
18
|
+
def initialize(client, endpoint, settings)
|
19
|
+
@http_client = client
|
20
|
+
@endpoint_url = endpoint
|
21
|
+
@retry_settings = settings
|
22
|
+
@error_codes = [500, 502, 503, 504]
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
public
|
27
|
+
|
28
|
+
def send(request)
|
29
|
+
|
30
|
+
if @retry_settings.maximum_number_of_retries == 0
|
31
|
+
response = @http_client.send_request(request)
|
32
|
+
response
|
33
|
+
end
|
34
|
+
|
35
|
+
attempts = 0
|
36
|
+
|
37
|
+
loop do
|
38
|
+
wait_interval = @retry_settings.get_next_wait_interval(attempts)
|
39
|
+
|
40
|
+
begin
|
41
|
+
response = @http_client.send_request(request)
|
42
|
+
|
43
|
+
if (@error_codes.include? response.status_code.to_i) && (attempts < @retry_settings.maximum_number_of_retries)
|
44
|
+
attempts += 1
|
45
|
+
else
|
46
|
+
response
|
47
|
+
end
|
48
|
+
|
49
|
+
rescue Timeout::Error => exception
|
50
|
+
attempts += 1
|
51
|
+
|
52
|
+
if attempts > @retry_settings.maximum_number_of_retries
|
53
|
+
raise exception
|
54
|
+
end
|
55
|
+
sleep(wait_interval)
|
56
|
+
|
57
|
+
rescue Exception => exception
|
58
|
+
raise exception
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require_relative '../version.rb'
|
2
|
+
|
3
|
+
module SocketLabs
|
4
|
+
module InjectionApi
|
5
|
+
class RetrySettings
|
6
|
+
|
7
|
+
private
|
8
|
+
attr_accessor :default_number_of_retries
|
9
|
+
attr_accessor :maximum_allowed_number_of_retries
|
10
|
+
attr_accessor :minimum_retry_time
|
11
|
+
attr_accessor :maximum_retry_time
|
12
|
+
|
13
|
+
public
|
14
|
+
attr_accessor :maximum_number_of_retries
|
15
|
+
|
16
|
+
def initialize(maximum_retries=nil)
|
17
|
+
|
18
|
+
@default_number_of_retries = 0
|
19
|
+
@maximum_allowed_number_of_retries = 5
|
20
|
+
@minimum_retry_time = 1
|
21
|
+
@maximum_retry_time = 10
|
22
|
+
|
23
|
+
unless maximum_retries.nil?
|
24
|
+
|
25
|
+
if maximum_retries < 0
|
26
|
+
raise ArgumentError.new "maximum_number_of_retries must be greater than 0"
|
27
|
+
end
|
28
|
+
|
29
|
+
if maximum_retries > @maximum_allowed_number_of_retries
|
30
|
+
raise ArgumentError.new "The maximum number of allowed retries is " + @maximum_allowed_number_of_retries
|
31
|
+
end
|
32
|
+
|
33
|
+
@maximum_number_of_retries = maximum_retries
|
34
|
+
|
35
|
+
else
|
36
|
+
@maximum_number_of_retries = @default_number_of_retries
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_next_wait_interval(number_of_attempts)
|
42
|
+
|
43
|
+
interval = [@minimum_retry_time * 1000 + get_retry_delta(number_of_attempts), @maximum_retry_time * 1000].min
|
44
|
+
interval
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def get_retry_delta(number_of_attempts)
|
49
|
+
|
50
|
+
random = Random.new
|
51
|
+
|
52
|
+
min = (1 * 1000 * 0.8).to_i
|
53
|
+
max = (1 * 1000 * 1.2).to_i
|
54
|
+
|
55
|
+
(((2.0 ** number_of_attempts) - 1.0) * random.rand(min..max)).to_i
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -7,6 +7,8 @@ require_relative 'message/basic_message.rb'
|
|
7
7
|
require_relative 'message/bulk_message.rb'
|
8
8
|
require_relative 'core/injection_request_factory.rb'
|
9
9
|
require_relative 'core/http_request.rb'
|
10
|
+
require_relative 'core/retryhandler.rb'
|
11
|
+
require_relative 'retrysettings.rb'
|
10
12
|
|
11
13
|
module SocketLabs
|
12
14
|
module InjectionApi
|
@@ -27,6 +29,8 @@ module SocketLabs
|
|
27
29
|
@api_key = api_key
|
28
30
|
@proxy = proxy
|
29
31
|
@endpoint = "https://inject.socketlabs.com/api/v1/email"
|
32
|
+
@request_timeout = 120
|
33
|
+
@number_of_retries = 0
|
30
34
|
end
|
31
35
|
|
32
36
|
# Sends a Message message and returns the response from the Injection API.
|
@@ -62,6 +66,11 @@ module SocketLabs
|
|
62
66
|
# The SocketLabs Injection API endpoint Url
|
63
67
|
attr_accessor :endpoint
|
64
68
|
|
69
|
+
public
|
70
|
+
# The SocketLabs Injection API Request Timeout
|
71
|
+
attr_accessor :request_timeout
|
72
|
+
attr_accessor :number_of_retries
|
73
|
+
|
65
74
|
def http_method
|
66
75
|
HttpRequest.http_request_method[:Post]
|
67
76
|
end
|
@@ -84,9 +93,14 @@ module SocketLabs
|
|
84
93
|
debug_json = request_hash.to_json
|
85
94
|
@request_json = debug_json
|
86
95
|
|
87
|
-
http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })
|
88
|
-
|
89
|
-
|
96
|
+
http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy, :timeout => @request_timeout })
|
97
|
+
retry_handler = RetryHandler.new(http_request, @endpoint, RetrySettings.new(@number_of_retries))
|
98
|
+
response = retry_handler.send(request)
|
99
|
+
|
100
|
+
parser = InjectionResponseParser.new
|
101
|
+
parser.parse(response)
|
102
|
+
|
103
|
+
@response_json = parser.to_json
|
90
104
|
|
91
105
|
end
|
92
106
|
|
@@ -108,9 +122,14 @@ module SocketLabs
|
|
108
122
|
debug_json = request_hash.to_json
|
109
123
|
@request_json = debug_json
|
110
124
|
|
111
|
-
http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })
|
112
|
-
|
113
|
-
|
125
|
+
http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy, :timeout => @request_timeout })
|
126
|
+
retry_handler = RetryHandler.new(http_request, @endpoint, RetrySettings.new(@number_of_retries))
|
127
|
+
response = retry_handler.send(request)
|
128
|
+
|
129
|
+
parser = InjectionResponseParser.new
|
130
|
+
parser.parse(response)
|
131
|
+
|
132
|
+
@response_json = parser.to_json
|
114
133
|
|
115
134
|
end
|
116
135
|
|
data/lib/socketlabs/version.rb
CHANGED
@@ -6,7 +6,7 @@ require 'socketlabs/version.rb'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'socketlabs-injectionapi'
|
8
8
|
spec.version = SocketLabs::InjectionApi::VERSION
|
9
|
-
spec.authors = ['David Schrenker']
|
9
|
+
spec.authors = ['David Schrenker', 'Praneeth Chandra']
|
10
10
|
spec.email = 'developers@socketlabs.com'
|
11
11
|
spec.summary = 'SocketLabs Injection Api'
|
12
12
|
spec.description = 'SocketLabs Email Delivery Ruby Client library'
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socketlabs-injectionapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Schrenker
|
8
|
+
- Praneeth Chandra
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
12
13
|
dependencies: []
|
13
14
|
description: SocketLabs Email Delivery Ruby Client library
|
14
15
|
email: developers@socketlabs.com
|
@@ -34,6 +35,7 @@ files:
|
|
34
35
|
- lib/socketlabs/injectionapi/core/http_response.rb
|
35
36
|
- lib/socketlabs/injectionapi/core/injection_request_factory.rb
|
36
37
|
- lib/socketlabs/injectionapi/core/injection_response_parser.rb
|
38
|
+
- lib/socketlabs/injectionapi/core/retryhandler.rb
|
37
39
|
- lib/socketlabs/injectionapi/core/send_validator.rb
|
38
40
|
- lib/socketlabs/injectionapi/core/serialization/address_json.rb
|
39
41
|
- lib/socketlabs/injectionapi/core/serialization/attachment_json.rb
|
@@ -54,6 +56,7 @@ files:
|
|
54
56
|
- lib/socketlabs/injectionapi/message/merge_data.rb
|
55
57
|
- lib/socketlabs/injectionapi/message/message_base.rb
|
56
58
|
- lib/socketlabs/injectionapi/proxy.rb
|
59
|
+
- lib/socketlabs/injectionapi/retrysettings.rb
|
57
60
|
- lib/socketlabs/injectionapi/send_response.rb
|
58
61
|
- lib/socketlabs/injectionapi/send_result.rb
|
59
62
|
- lib/socketlabs/injectionapi/socketlabsclient.rb
|