server_sent_events 0.1.1 → 0.1.2

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
2
  SHA256:
3
- metadata.gz: 05ed53b101be918022fc74531322fc13b786814091a648eecd508fb4f5295bea
4
- data.tar.gz: 9e2d11583211f22d939257aae1b0caa79ecd3da21d9206002bc439d03af464d4
3
+ metadata.gz: e78a58f0bae0af943ea4eb80dc128d25e61e242390e14e5c58050d68dbe4ff2c
4
+ data.tar.gz: b241e5065b1981b941b9f4c517008ecc7b228577c06dabc1d55012df4ca57a58
5
5
  SHA512:
6
- metadata.gz: 660cba4e4503ce997d90b2fdb3b3855591dc5a5ccf76e825efbd08de9167dc06d85049539b655aa568704928575b4b3c05f8460983298f390a7be5197cf0655c
7
- data.tar.gz: d0f6cb0fa38af1c328bb3e6c3fbd0feb8764e35bdf1537a5264e7f9397dffd3cce368c8ebe2421e468d1244c3407b51e0db884f92ff55d4128facf9e1933224b
6
+ metadata.gz: c56f578a27e59e90f98fb2d9a92fa44fd42f207b6594b2226f41c6ac1b4066f9045abb8c487ed87026a318b0cf4f41d57ff5942701c43f2c9a0a441feaa596a9
7
+ data.tar.gz: e42101bca2af7b0f147437fa9524ca1112d56adad6970ad8d34dd523f7e0ec75fe475265f99fc42e51476a7b7a05c44d40c145413965e23428b463531f1d0ed0
@@ -7,7 +7,7 @@ require "server_sent_events/client"
7
7
  require "server_sent_events/parser"
8
8
 
9
9
  module ServerSentEvents
10
- # Convenience method go the up-and running fast.
10
+ # Convenience method to get up-and-running fast.
11
11
  #
12
12
  # In order to start listening to server events, this is all the code that we
13
13
  # need:
@@ -15,7 +15,20 @@ module ServerSentEvents
15
15
  # ServerSentEvents.listen("http://example.com") do |event|
16
16
  # puts event
17
17
  # end
18
+ #
19
+ # @param address [String, URI] SSE endpoint
20
+ # @param headers [Hash] HTTP headers to use when connecting
21
+ # @param callback code block that should be executed on event arrival
18
22
  def self.listen(address, headers = {}, &callback)
19
- Client.new(URI(address), Parser.new, headers).listen(&callback)
23
+ create_client(address, headers).listen(&callback)
24
+ end
25
+
26
+ # Create new client that uses default parser to parse events.
27
+ #
28
+ # @param address [String, URI] SSE endpoint
29
+ # @param headers [Hash] HTTP headers to use when connecting
30
+ # @return [Client] client
31
+ def self.create_client(address, headers = {})
32
+ Client.new(URI(address), Parser.new, headers)
20
33
  end
21
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ServerSentEvents
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_sent_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tadej Borovšak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-22 00:00:00.000000000 Z
11
+ date: 2018-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler