zulip-client 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/README.md +2 -2
- data/lib/zulip/client.rb +8 -2
- data/lib/zulip/client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28469725b7fb68767bb0d61bee21ba57d07981c2
|
4
|
+
data.tar.gz: 25b5846794a969010cda1b67e562db4ee3f5a057
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62ce637e1393b02ed343fd6b4aa4a3cff6bcc8f553c1262fffda5c579a9a53f804c5f16ea7f7d9abae927bacf7fb3b94cfa47dda289f46069b964815f4ba1b51
|
7
|
+
data.tar.gz: ce9e95208c481471fda11f018d5edc917ec2df6d1554a2fe1b1bc8181873abe6c401460705b907187eae4014c592608cd5a8fe683b30c71d4e75f4241edc0e65
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -32,8 +32,8 @@ client.send_message(type: :stream, to: "general", subject: "projects", content:
|
|
32
32
|
Send private message to users:
|
33
33
|
|
34
34
|
```ruby
|
35
|
-
client.send_message(type: :
|
36
|
-
client.send_message(type: :
|
35
|
+
client.send_message(type: :private, to: "user@zulip.example.com", content: "Hello, Zulip!")
|
36
|
+
client.send_message(type: :private, to: ["user1@zulip.example.com", "user2@zulip.example.com"], content: "Hello, Zulip!")
|
37
37
|
```
|
38
38
|
|
39
39
|
Receive all events:
|
data/lib/zulip/client.rb
CHANGED
@@ -68,10 +68,14 @@ module Zulip
|
|
68
68
|
request.url("/api/v1/events")
|
69
69
|
request.body = { "queue_id" => queue_id }
|
70
70
|
end
|
71
|
-
|
71
|
+
case
|
72
|
+
when response.success?
|
72
73
|
JSON.parse(response.body, symbolize_names: true)[:result] == "success"
|
74
|
+
when (400..499).include?(response.status)
|
75
|
+
res = JSON.parse(response.body, symbolize_names: true)
|
76
|
+
raise Zulip::ResponseError, res[:msg]
|
73
77
|
else
|
74
|
-
raise Zulip::ResponseError,
|
78
|
+
raise Zulip::ResponseError, response.reason_phrase
|
75
79
|
end
|
76
80
|
end
|
77
81
|
|
@@ -85,6 +89,7 @@ module Zulip
|
|
85
89
|
break unless @running
|
86
90
|
response = get_events(queue_id: queue_id, last_event_id: last_event_id)
|
87
91
|
response_writer.write(response)
|
92
|
+
sleep(1)
|
88
93
|
end
|
89
94
|
end
|
90
95
|
buf = ""
|
@@ -136,6 +141,7 @@ module Zulip
|
|
136
141
|
request.url("/api/v1/events")
|
137
142
|
request.params["queue_id"] = queue_id
|
138
143
|
request.params["last_event_id"] = last_event_id
|
144
|
+
request.params["dont_block"] = true
|
139
145
|
end
|
140
146
|
if response.success?
|
141
147
|
response.body
|
data/lib/zulip/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zulip-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okkez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -102,6 +102,7 @@ extensions: []
|
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
105
106
|
- Gemfile
|
106
107
|
- LICENSE.txt
|
107
108
|
- README.md
|