slack-rtmapi 1.0.0.rc2 → 1.0.0.rc3

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
  SHA1:
3
- metadata.gz: b3b0b5dd151c9091ad6b4475ba67ed442a5bb286
4
- data.tar.gz: d1cded39a35ba0fe232c48b8822bafb5d046c69c
3
+ metadata.gz: 2e5e90050638a0d2937d6401f0324edd7b640c25
4
+ data.tar.gz: 254f9e04c95f69c97d2dc1c7ae14bbecf34ff8a0
5
5
  SHA512:
6
- metadata.gz: 3085cc65d5e7760446b8871227ca940479362bf9611c3172662fc9cdce7261958be785deaa1e062fb4c3172c0ab7dfa9e3de25c9199f102c1c2f3703108e136f
7
- data.tar.gz: f4020460b802359417fe38df5f118e7c68cb823190eab300f44acc830fd206f448d89d0e021829e01aa45dc3cd4c883b0081cdafc6197c7951670d9767822f1a
6
+ metadata.gz: 08f0c3f7f0cdc5543bfaf84ab3204143f8c9f4d201a54f57a8fc053a9ae7c5e017b94da6e6a84dbbf5b6f14439d528576bc6f1172af9786a4e7de60f6d71baf7
7
+ data.tar.gz: 42f0f27d1ce6661617e3aef01af836923059f1e021a0d85423bb6cc97b3e21007a62ada8732b5873b2a94b032681311510aa3d5e2765dd6aad87d64c5f4780cc
data/README.md CHANGED
@@ -4,7 +4,7 @@ slack-rtmapi
4
4
  All you need to use the RTM api of Slack
5
5
 
6
6
  Please note that this gem is GPLv3. You *CAN'T* use it for proprietary software.
7
- If you need a licence, please contact me and I will respond in the 24 hours.
7
+ If you need a licence, please contact me and I will respond within the 24 hours.
8
8
 
9
9
  HOW TO USE
10
10
  ----------
@@ -12,10 +12,11 @@ HOW TO USE
12
12
  ```ruby
13
13
  require 'slack-rtmapi'
14
14
 
15
- url = SlackRTM.get_url token: 'xxx'
15
+ url = SlackRTM.get_url token: 'xxx' # get one on https://api.slack.com/web#basics
16
16
  client = SlackRTM::Client.new websocket_url: url
17
17
 
18
18
  client.on :message {|data| p data}
19
+ client.send {type: 'hello'}
19
20
 
20
21
  client.main_loop
21
22
  assert false # never ending loop
@@ -25,7 +25,7 @@ module SlackRTM
25
25
  VALID = [:open, :message, :error]
26
26
  def on(type, &block)
27
27
  unless VALID.include? type
28
- raise ArgumentError.new "Client#on(type) takes on type of #{VALID.inspect}"
28
+ raise ArgumentError.new "Client#on accept one of #{VALID.inspect}"
29
29
  end
30
30
 
31
31
  @callbacks ||= {}
@@ -42,29 +42,18 @@ module SlackRTM
42
42
  def init
43
43
  return if @has_been_init
44
44
 
45
- puts "begin init. Init SSL"
46
-
47
45
  @socket = init_socket(@socket)
48
46
  @socket.connect # costly and blocking !
49
47
 
50
- puts "end connect. Init wrapper"
51
-
52
48
  internalWrapper = (Struct.new :url, :socket do
53
49
  def write(*args)
54
- puts 'write called'
55
50
  self.socket.write(*args)
56
51
  end
57
52
  end).new @url.to_s, @socket
58
53
 
59
- puts 'end wrapper. Init driver'
60
-
61
54
  # this, also, is costly and blocking
62
55
  @driver = WebSocket::Driver.client internalWrapper
63
-
64
- puts "end driver. Init callbacks"
65
-
66
56
  @driver.on :open do
67
- puts "connected !"
68
57
  @connected = true
69
58
  unless @callbacks[:open].nil?
70
59
  @callbacks[:open].call
@@ -76,7 +65,6 @@ module SlackRTM
76
65
  unless @callbacks[:error].nil?
77
66
  @callbacks[:error].call
78
67
  end
79
- raise event
80
68
  end
81
69
 
82
70
  @driver.on :message do |event|
@@ -85,13 +73,7 @@ module SlackRTM
85
73
  @callbacks[:message].call data
86
74
  end
87
75
  end
88
-
89
- puts "end callbacks. Starting driver"
90
-
91
76
  @driver.start
92
-
93
- puts 'end init'
94
-
95
77
  @has_been_init = true
96
78
  end
97
79
 
@@ -101,7 +83,6 @@ module SlackRTM
101
83
 
102
84
  # All the polling work is done here
103
85
  def inner_loop
104
- putc '.'
105
86
  return if @stop
106
87
  data = @socket.readpartial 4096
107
88
  return if data.nil? or data.empty?
@@ -1,3 +1,3 @@
1
1
  module SlackRTM
2
- VERSION = "1.0.0.rc2"
2
+ VERSION = "1.0.0.rc3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-rtmapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mackwic