Class: SmeeClient
- Inherits:
-
Object
- Object
- SmeeClient
- Defined in:
- lib/smee.rb
Overview
The main Smee client class
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(source:, target:) ⇒ SmeeClient
constructor
A new instance of SmeeClient.
- #start ⇒ Object
Constructor Details
#initialize(source:, target:) ⇒ SmeeClient
14 15 16 17 |
# File 'lib/smee.rb', line 14 def initialize(source:, target:) @source = source @target = URI.parse(target) end |
Class Method Details
.create_channel ⇒ Object
9 10 11 12 |
# File 'lib/smee.rb', line 9 def self.create_channel response = HTTParty.head('https://smee.io/new', follow_redirects: false) response.headers['location'] end |
Instance Method Details
#close ⇒ Object
24 25 26 27 |
# File 'lib/smee.rb', line 24 def close puts '[SmeeClient]: Closing connection' @events.close end |
#start ⇒ Object
19 20 21 22 |
# File 'lib/smee.rb', line 19 def start puts "[SmeeClient]: Listening for events at #{@source}" subscribe end |