socketlabs-injectionapi 1.4.2 → 1.4.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f557916e593c897978060429a0bdb300c61f5047fc879902a2f43ad7a8bffbab
4
- data.tar.gz: 31a2adba06e1794c3c1b49e23bb7dbdc6de4be1bc1349e6c0d0cc5ed53cc4757
3
+ metadata.gz: 8cb53859e473d0b39783967b98f0c1d44a5bbd2d9e3a41518e9831dad9d3274a
4
+ data.tar.gz: c710342add94849a727216e28ab82e33c07bb57b4ec80fd370f246a11c34520d
5
5
  SHA512:
6
- metadata.gz: 143016ece80ad2d42de386599a0455e1fad50172c5471ff74773fb180ec6cbd3a8d100baec4d31ffcf776a11f29bf7e2541c93633acd20bfa70fc8d397919a11
7
- data.tar.gz: 13097dbd02d8ba26a590b42fe1da47c115049642c2eb74cad3cf1571b4e8c28ce08efbe56cabc266dd9e2e1d4a5bbc8f94fc7da25a84f4336de1971e013ea8b5
6
+ metadata.gz: 56d7c9867149469570940396836f8c69c2bf1e060774932ae5f7d8a3b98ecb9a89faf5544b03318cb489984222e003361078518bf6cecc12c2f1caa8e0f9ee1d
7
+ data.tar.gz: f09a1e585ba59a97862ff888dc659f2a49ce3e91b419c984389daea0910843d60829afe915ea1614ec816da8d0aae3c101ff9ff440e21a27d6c276016f81bb16
data/README.MD CHANGED
@@ -216,6 +216,8 @@ For more information about AMP please see [AMP Project](https://amp.dev/document
216
216
 
217
217
  <a name="version"></a>
218
218
  # Version
219
+ * 1.4.2 - Adding API Key Authorization
220
+ * 1.4.0 - Adding Metadata and Tags
219
221
  * 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
222
  * 1.1.1 - Adding request timeout value on the client for Http requests
221
223
  * 1.1.0 - Adds Amp Html Support
@@ -11,31 +11,55 @@ module SocketLabs
11
11
  "None" =>
12
12
  {
13
13
  :name => "None",
14
- :value =>0,
14
+ :value => 0,
15
+ },
16
+ # Invalid key length was found.
17
+ "InvalidKeyLength" =>
18
+ {
19
+ :name => "InvalidKeyLength",
20
+ :value => 1,
21
+ },
22
+ # Invalid key format was found.
23
+ "InvalidKeyFormat" =>
24
+ {
25
+ :name => "InvalidKeyFormat",
26
+ :value => 2,
15
27
  },
16
28
  # The key was found to be blank or invalid.
17
29
  "InvalidEmptyOrWhitespace" =>
18
30
  {
19
31
  :name => "InvalidEmptyOrWhitespace",
20
- :value =>1,
32
+ :value => 3,
21
33
  },
22
34
  # The public portion of the key was unable to be parsed.
23
35
  "InvalidUnableToExtractPublicPart" =>
24
36
  {
25
37
  :name => "InvalidUnableToExtractPublicPart",
26
- :value =>2,
38
+ :value => 4,
27
39
  },
28
40
  # The secret portion of the key was unable to be parsed.
29
41
  "InvalidUnableToExtractSecretPart" =>
30
42
  {
31
43
  :name => "InvalidUnableToExtractSecretPart",
32
- :value =>3,
44
+ :value => 5,
45
+ },
46
+ # The public portion of the key is the incorrect length.
47
+ "InvalidPublicPartLength" =>
48
+ {
49
+ :name => "InvalidPublicPartLength",
50
+ :value => 6,
51
+ },
52
+ # The secret portion of the key is the incorrect length.
53
+ "InvalidSecretPartLength" =>
54
+ {
55
+ :name => "InvalidSecretPartLength",
56
+ :value => 7,
33
57
  },
34
58
  # Key was successfully parsed.
35
59
  "Success" =>
36
60
  {
37
61
  :name => "Success",
38
- :value =>4,
62
+ :value => 8,
39
63
  }
40
64
  }
41
65
  end
@@ -9,7 +9,7 @@ module SocketLabs
9
9
 
10
10
  # Parse the API key to determine what kind of key was provided.
11
11
  # @param [String] wholeApiKey: A ApiKeyParseResult with the parsing results
12
- # @return [ApiKeyParseResult] the SendResponse from the request
12
+ # @return [ApiKeyParseResult] the ApiKeyParseResult from the request
13
13
  def parse(
14
14
  wholeApiKey
15
15
  )
@@ -137,6 +137,20 @@ module SocketLabs
137
137
  debug_json = request_hash.to_json
138
138
  @request_json = debug_json
139
139
 
140
+ apiKeyParser = ApiKeyParser.new()
141
+ parseResult = apiKeyParser.parse(@api_key);
142
+
143
+ httpArguments = {
144
+ :http_endpoint => @endpoint,
145
+ :proxy => @proxy,
146
+ :timeout => @request_timeout,
147
+ :authorization => ''
148
+ }
149
+ if parseResult == ApiKeyParseResult.enum["Success"]
150
+ httpArguments[:authorization] = @api_key
151
+ request.api_key = ''
152
+ end
153
+
140
154
  http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy, :timeout => @request_timeout })
141
155
  retry_handler = RetryHandler.new(http_request, @endpoint, RetrySettings.new(@number_of_retries))
142
156
  response = retry_handler.send(request)
@@ -1,5 +1,5 @@
1
1
  module SocketLabs
2
2
  module InjectionApi
3
- VERSION = '1.4.2'
3
+ VERSION = '1.4.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socketlabs-injectionapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Schrenker