sse-client 1.0.1 → 1.1.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sse-client.rb +5 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ea10d56000f2ff8f48c70caeafb48188185d120
4
- data.tar.gz: b140cff155241bc08bb0c94c68d40ba6181dab85
3
+ metadata.gz: 14ee18e06a5a559bfb3390a4857e4c13c6976917
4
+ data.tar.gz: 2f95cad910f0c201a18e74f1bb61e4e05e958aaa
5
5
  SHA512:
6
- metadata.gz: cc74b7921ce548ee4e043aa7f42d995fba5f7c35a30ef283a44105e5197c7ecf46a875fa7753f79c02a6452cc5b87971048452f05a813a257602e1d9113e3091
7
- data.tar.gz: c101bfcf4ba4b0a1acbface19613168bfff197cf3c52da144516a7493dd56651178e6b05d3d04cdd8dd75a0e8b9fbbb162ae21014e0070b1ae9bd6b9121bffd0
6
+ metadata.gz: e9109313148f63ee6593c89d550a7b48f5cd06c3d177a6236eca4087a3a1f84cfb076590276680b517b002700d8c8993d6ffc9fc5df74ab26337b8daeaae8f5c
7
+ data.tar.gz: 10229991e03a9c15ebe6086d540b2d0444e2542f0a7da4092a919658135ad767ade27b0ddb153498767aa4e1315c2c6a4402db9f956489d03e845d9540ede60b
@@ -16,11 +16,12 @@ module SSE
16
16
  # The connection is not open, and the user agent is not trying to reconnect. Either there was a fatal error or the close() method was invoked.
17
17
  CLOSED = 2
18
18
 
19
- def initialize(url = "http://localhost:2333/portal/app_api_call_stats?begin=2017-09-30&end=2017-10-31&interval=day&app_id=8ab88b1d", query = {}, headers = {})
19
+ def initialize(url, query = {}, headers = {}, before_execution_proc: nil)
20
20
  @url = url
21
21
  @headers = headers
22
22
  @headers['params'] = query
23
23
  @ready_state = CLOSED
24
+ @before_execution_proc = before_execution_proc
24
25
 
25
26
  @opens = []
26
27
  @errors = []
@@ -67,13 +68,14 @@ module SSE
67
68
  end
68
69
  close
69
70
  else
70
- handle_error response.body
71
+ handle_error response
71
72
  end
72
73
  }
73
74
  conn = RestClient::Request.execute(method: :get,
74
75
  url: @url,
75
76
  headers: @headers,
76
- block_response: block)
77
+ block_response: block,
78
+ before_execution_proc: @before_execution_proc)
77
79
  end
78
80
 
79
81
  def handle_stream(stream)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sse-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - oplinjie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client