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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36c17178e04f2496376cf314e9b84a3127388ec6
4
- data.tar.gz: 54147ac098aec2a9752559eaa5065e52df37fdc3
3
+ metadata.gz: 28469725b7fb68767bb0d61bee21ba57d07981c2
4
+ data.tar.gz: 25b5846794a969010cda1b67e562db4ee3f5a057
5
5
  SHA512:
6
- metadata.gz: 87332a49fd0563c1a890e2e70fe25c21574d2ef4d3936e3a7983175b8a8177cbd71b2cb82ae87700ede763a37da059b159654ce3aa53c987f22327515a5dafcd
7
- data.tar.gz: 50024a7648efd7a1c044e692c0e07396c2749b6ec70044fe9945eced182b6a430f2938f334426b30994780749f686c47245341fc155d801f85608d2297ab29f3
6
+ metadata.gz: 62ce637e1393b02ed343fd6b4aa4a3cff6bcc8f553c1262fffda5c579a9a53f804c5f16ea7f7d9abae927bacf7fb3b94cfa47dda289f46069b964815f4ba1b51
7
+ data.tar.gz: ce9e95208c481471fda11f018d5edc917ec2df6d1554a2fe1b1bc8181873abe6c401460705b907187eae4014c592608cd5a8fe683b30c71d4e75f4241edc0e65
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ sudo: false
2
+
3
+ rvm:
4
+ - 2.4.1
5
+ - 2.3.4
6
+ - 2.2
7
+ - 2.1
8
+
9
+ before_install:
10
+ - gem update bundler
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: :stream, to: "user@zulip.example.com", content: "Hello, Zulip!")
36
- client.send_message(type: :stream, to: ["user1@zulip.example.com", "user2@zulip.example.com"], content: "Hello, Zulip!")
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
- if response.success?
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, reqponse.reason_phrase
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
@@ -1,5 +1,5 @@
1
1
  module Zulip
2
2
  class Client
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
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.1
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-05 00:00:00.000000000 Z
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