erorr 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f525515b28f01c1aa96066d3b5ac4942b937745f
4
- data.tar.gz: d6c8f3beead3c09997526de3509646d5d8585b5b
2
+ SHA256:
3
+ metadata.gz: bac02e4b1328a39a8ab38697067259c3cb0429e5e7fb9085c343a0aa0ed963aa
4
+ data.tar.gz: cfbe5aaed5831f3e19344bd1c636b7947ba3b19dec07d0e52e1cf8a9056882ad
5
5
  SHA512:
6
- metadata.gz: 370409a980216e83c684c70352d190b74eb3ef3b2352961ffdfcfcc4c22fc7e0e1caaf38a65eb63cf1b8e9069a45b0fe41badce620e9c4db1422809a450ec2a2
7
- data.tar.gz: 6522426c527670f59d14746e9c4755dfa5402d36e4d560a327d2910a481f79a5e12727acda0dee542b74cba0a284bd300e1f5af7530d80a840c8ab1a5eb2f8bd
6
+ metadata.gz: 416f886c1bcf10eb555d094f592482e920a7a407c899bf91ceafdf9ce9bdbddc9c680811348d116c63e29d4b731cfa08d229309e7bf7697e6883a0273fd41679
7
+ data.tar.gz: 4a228f20669340c15ac5f4fe344e105be37095fa229a704f9702e1a68c8a8f2ed5e9301f15055ebde06275f40a9692a9ab65497bdfa5389fa16838136ce8cb2d
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ *.gem
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/Gemfile.lock CHANGED
@@ -1,33 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- erorr (0.1.0)
4
+ erorr (0.1.2)
5
5
  commander (~> 4.4)
6
6
  concurrent-ruby (~> 1.0)
7
- http
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
11
10
  specs:
12
- addressable (2.6.0)
13
- public_suffix (>= 2.0.2, < 4.0)
14
11
  commander (4.4.7)
15
12
  highline (~> 2.0.0)
16
- concurrent-ruby (1.1.4)
13
+ concurrent-ruby (1.1.5)
17
14
  diff-lcs (1.3)
18
- domain_name (0.5.20180417)
19
- unf (>= 0.0.5, < 1.0.0)
20
15
  highline (2.0.1)
21
- http (4.0.5)
22
- addressable (~> 2.3)
23
- http-cookie (~> 1.0)
24
- http-form_data (~> 2.0)
25
- http_parser.rb (~> 0.6.0)
26
- http-cookie (1.0.3)
27
- domain_name (~> 0.5)
28
- http-form_data (2.1.1)
29
- http_parser.rb (0.6.0)
30
- public_suffix (3.0.3)
31
16
  rake (10.5.0)
32
17
  rspec (3.8.0)
33
18
  rspec-core (~> 3.8.0)
@@ -42,9 +27,6 @@ GEM
42
27
  diff-lcs (>= 1.2.0, < 2.0)
43
28
  rspec-support (~> 3.8.0)
44
29
  rspec-support (3.8.0)
45
- unf (0.1.4)
46
- unf_ext
47
- unf_ext (0.0.7.5)
48
30
 
49
31
  PLATFORMS
50
32
  ruby
data/erorr.gemspec CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = 'bin'
22
22
  spec.executables << 'erorr'
23
23
 
24
- spec.add_dependency 'http'
25
24
  spec.add_dependency 'concurrent-ruby', '~> 1.0'
26
25
  spec.add_dependency 'commander', '~> 4.4'
27
26
 
data/lib/erorr/cli.rb CHANGED
@@ -68,6 +68,8 @@ module Erorr
68
68
  else
69
69
  say_error 'Test notification could not be delivered.'
70
70
  end
71
+
72
+ Erorr::Transport::HTTPAsync.shut_down
71
73
  end
72
74
  end
73
75
  end
@@ -1,4 +1,5 @@
1
- require 'http'
1
+ require 'net/http'
2
+ require 'uri'
2
3
  require 'concurrent'
3
4
 
4
5
  module Erorr
@@ -9,10 +10,26 @@ module Erorr
9
10
  @api_url = Erorr.config.api_url
10
11
  end
11
12
 
13
+ class << self
14
+ def thread_pool
15
+ @thread_pool ||= Concurrent::ThreadPoolExecutor.new(max_threads: 5)
16
+ end
17
+
18
+ def shut_down
19
+ thread_pool.shutdown
20
+ thread_pool.wait_for_termination
21
+ end
22
+ end
23
+
12
24
  def deliver(params)
13
- # Concurrent::Promises.future do
14
- HTTP.post "#{@api_url}/faults", json: {fault: params, api_key: @api_key}
15
- # end.rescue { |error| log_error error}
25
+ self.class.thread_pool.post do
26
+ uri = URI("#{@api_url}/faults")
27
+ request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
28
+ request.body = {fault: params, api_key: @api_key}.to_json
29
+ Net::HTTP.start(uri.hostname, uri.port) do |http|
30
+ http.request request
31
+ end
32
+ end
16
33
  end
17
34
  end
18
35
  end
data/lib/erorr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Erorr
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erorr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georgi Mitrev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: http
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
13
  - !ruby/object:Gem::Dependency
28
14
  name: concurrent-ruby
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -141,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
127
  version: '0'
142
128
  requirements: []
143
129
  rubyforge_project:
144
- rubygems_version: 2.5.2.3
130
+ rubygems_version: 2.7.6
145
131
  signing_key:
146
132
  specification_version: 4
147
133
  summary: Ruby library for erorr.app