securenative 0.1.18 → 0.1.20

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: 8d858e629da2a2f7f0c3cfaed2578bebe8560231c80b150a63286c2b06783aa4
4
- data.tar.gz: ad059fb8d2ae68ee261cc42fc33039091ef69988d81d5df268a9480006b21509
3
+ metadata.gz: 3d6008fff3b5f2dea4e6d6680af895c51a18a14a80a495f1fbe3da99513d955b
4
+ data.tar.gz: 6de47ae10eb46753aa40d1854ed35d42f961c39543bd12e931f80d191d033114
5
5
  SHA512:
6
- metadata.gz: c011475a3513e520305e4a7fab927238050b22c29142b726801544b10c7dd6fdba348a0eb9ac3dee2e69b67dca037fa77aa1ed2f4cae1ae6f6ec95293855d93f
7
- data.tar.gz: 811bb374f34727eb9c0ef82ec3fa7e54248cfa753fb880129660643716e79dbaf56b276f87fb63e711bc32544020b3f6eedea09f88578f71eaab6f85d6c5468f
6
+ metadata.gz: 61c717b498a2a0464ad74fd32a1daca48f8ff115348f0b8a49710d54e3ce7f6d99f21c92560b8936c64548e08ba9ddd2cf105902d614f656925a15d9fa7094e4
7
+ data.tar.gz: 7667f250f61f1629cdf36829e8f74ce74bcd66e862b183051616c3774090229426b8b38d96e873cc58496f64f8774616c4104799c50e26df8266acf95c60948f
data/Gemfile CHANGED
@@ -3,9 +3,9 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
  gem "rspec"
5
5
  gem "rake"
6
- gem "httpclient"
7
6
  gem "parseconfig"
8
7
  gem "simplecov", :require => false, :group => :test
8
+ gem "codecov", :require => false, :group => :test
9
9
  gem "webmock", :require => false, :group => :test
10
10
  gem "rails", :require => false, :group => :test
11
11
  gem "hanami", :require => false, :group => :test
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- securenative (0.1.18)
4
+ securenative (0.1.20)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -64,6 +64,11 @@ GEM
64
64
  addressable (2.7.0)
65
65
  public_suffix (>= 2.0.2, < 5.0)
66
66
  builder (3.2.4)
67
+ codecov (0.2.6)
68
+ colorize
69
+ json
70
+ simplecov
71
+ colorize (0.8.1)
67
72
  concurrent-ruby (1.1.7)
68
73
  crack (0.4.3)
69
74
  safe_yaml (~> 1.0.0)
@@ -148,10 +153,10 @@ GEM
148
153
  http_router (0.11.2)
149
154
  rack (>= 1.0.0)
150
155
  url_mount (~> 0.2.1)
151
- httpclient (2.8.3)
152
156
  i18n (1.8.5)
153
157
  concurrent-ruby (~> 1.0)
154
158
  inflecto (0.0.2)
159
+ json (2.3.1)
155
160
  loofah (2.6.0)
156
161
  crass (~> 1.0.2)
157
162
  nokogiri (>= 1.5.9)
@@ -256,8 +261,8 @@ PLATFORMS
256
261
 
257
262
  DEPENDENCIES
258
263
  bundler (~> 2.0)
264
+ codecov
259
265
  hanami
260
- httpclient
261
266
  parseconfig
262
267
  rails
263
268
  rake
data/README.md CHANGED
@@ -36,7 +36,7 @@ gem 'securenative'
36
36
 
37
37
  Then execute:
38
38
 
39
- $ bundle
39
+ $ bundle install
40
40
 
41
41
  Or install it yourself as:
42
42
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.18
1
+ 0.1.20
@@ -64,7 +64,7 @@ class EventManager
64
64
  SecureNativeLogger.debug("Attempting to send event #{event}")
65
65
  res = @http_client.post(resource_path, EventManager.serialize(event).to_json)
66
66
 
67
- if res.status_code != 200
67
+ if res.code != 200
68
68
  SecureNativeLogger.info("SecureNative failed to call endpoint #{resource_path} with event #{event}. adding back to queue")
69
69
  item = QueueItem.new(resource_path, EventManager.serialize(event).to_json, retry_sending)
70
70
  @queue.append(item)
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'httpclient'
3
+ require 'net/http'
4
+ require 'uri'
5
+ require 'json'
4
6
 
5
7
  class SecureNativeHttpClient
6
8
  AUTHORIZATION_HEADER = 'Authorization'
7
9
  VERSION_HEADER = 'SN-Version'
8
10
  USER_AGENT_HEADER = 'User-Agent'
9
- USER_AGENT_HEADER_VALUE = 'SecureNative-python'
11
+ USER_AGENT_HEADER_VALUE = 'SecureNative-ruby'
10
12
  CONTENT_TYPE_HEADER = 'Content-Type'
11
13
  CONTENT_TYPE_HEADER_VALUE = 'application/json'
12
14
 
13
15
  def initialize(securenative_options)
14
16
  @options = securenative_options
15
- @client = HTTPClient.new
16
17
  end
17
18
 
18
19
  def _headers
@@ -25,8 +26,13 @@ class SecureNativeHttpClient
25
26
  end
26
27
 
27
28
  def post(path, body)
28
- url = "#{@options.api_url}/#{path}"
29
+ uri = URI.parse("#{@options.api_url}/#{path}")
29
30
  headers = _headers
30
- @client.post(url, body, headers)
31
+
32
+ client = Net::HTTP.new(uri.host, uri.port)
33
+ request = Net::HTTP::Post.new(uri.request_uri, headers)
34
+ request.body = body.to_json
35
+
36
+ client.request(request)
31
37
  end
32
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: securenative
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - SecureNative