ably-rest 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/ably-rest.gemspec +5 -5
- data/lib/submodules/ably-ruby/ably.gemspec +9 -6
- data/lib/submodules/ably-ruby/lib/ably/version.rb +1 -1
- data/lib/submodules/ably-ruby/spec/acceptance/realtime/client_spec.rb +1 -1
- data/lib/submodules/ably-ruby/spec/acceptance/rest/channel_spec.rb +1 -4
- data/lib/submodules/ably-ruby/spec/acceptance/rest/client_spec.rb +20 -20
- data/lib/submodules/ably-ruby/spec/acceptance/rest/presence_spec.rb +3 -12
- data/lib/submodules/ably-ruby/spec/spec_helper.rb +4 -2
- metadata +22 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27ef716f8df3e3ded4ffffdcdbfb94c018a30e74
|
4
|
+
data.tar.gz: 47d6e2d4b21491d1272c6c9d32b063e037d9c908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7dc932158f9bba9d026eab21b38820ab80ed6811c01140e4472e88dacaaed2d59f6e3965125e42e3b912cb4f47892bac2ed9ea3c66969f332a81bb6717c7bc
|
7
|
+
data.tar.gz: 2e826797df048e498f4c3083934df9219a42933d2286857fb1dd35c541730439bb4912220ddaa4032e7a2187fec5cf6e1cd5ae701262b89dde18a43f17e4b491
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# [Ably](https://www.ably.io)
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/ably/ably-ruby-rest.png)](https://travis-ci.org/ably/ably-ruby-rest)
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/ably-rest.svg)](http://badge.fury.io/rb/ably-rest)
|
4
5
|
|
5
6
|
A Ruby REST client library for [www.ably.io](https://www.ably.io), the realtime messaging service.
|
data/ably-rest.gemspec
CHANGED
@@ -41,12 +41,12 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_runtime_dependency 'addressable', '>= 2.0.0'
|
42
42
|
|
43
43
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
44
|
-
spec.add_development_dependency 'rake'
|
45
|
-
spec.add_development_dependency 'redcarpet'
|
44
|
+
spec.add_development_dependency 'rake', '~> 11.3'
|
45
|
+
spec.add_development_dependency 'redcarpet', '~> 3.3'
|
46
46
|
spec.add_development_dependency 'rspec', '~> 3.2.0'
|
47
|
-
spec.add_development_dependency 'rspec-retry'
|
48
|
-
spec.add_development_dependency 'yard'
|
49
|
-
spec.add_development_dependency 'webmock'
|
47
|
+
spec.add_development_dependency 'rspec-retry', '~> 0.4'
|
48
|
+
spec.add_development_dependency 'yard', '~> 0.9'
|
49
|
+
spec.add_development_dependency 'webmock', '~> 2.0'
|
50
50
|
|
51
51
|
unless RUBY_VERSION.match(/^1/)
|
52
52
|
spec.add_development_dependency 'pry'
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_runtime_dependency 'em-http-request', '~> 1.1'
|
23
23
|
spec.add_runtime_dependency 'statesman', '~> 1.0.0'
|
24
24
|
spec.add_runtime_dependency 'faraday', '~> 0.9'
|
25
|
+
|
25
26
|
if RUBY_VERSION.match(/^1/)
|
26
27
|
spec.add_runtime_dependency 'json', '< 2.0'
|
27
28
|
else
|
@@ -32,14 +33,16 @@ Gem::Specification.new do |spec|
|
|
32
33
|
spec.add_runtime_dependency 'addressable', '>= 2.0.0'
|
33
34
|
|
34
35
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
35
|
-
spec.add_development_dependency 'rake'
|
36
|
-
spec.add_development_dependency 'redcarpet'
|
36
|
+
spec.add_development_dependency 'rake', '~> 11.3'
|
37
|
+
spec.add_development_dependency 'redcarpet', '~> 3.3'
|
37
38
|
spec.add_development_dependency 'rspec', '~> 3.2.0' # version lock, see config.around(:example, :event_machine) in event_machine_helper.rb
|
38
|
-
spec.add_development_dependency 'rspec-retry'
|
39
|
-
spec.add_development_dependency 'yard'
|
40
|
-
spec.add_development_dependency 'webmock'
|
39
|
+
spec.add_development_dependency 'rspec-retry', '~> 0.4'
|
40
|
+
spec.add_development_dependency 'yard', '~> 0.9'
|
41
|
+
spec.add_development_dependency 'webmock', '~> 2.0'
|
41
42
|
|
42
|
-
|
43
|
+
unless RUBY_VERSION.match(/^1/)
|
44
|
+
spec.add_development_dependency 'coveralls'
|
45
|
+
end
|
43
46
|
|
44
47
|
unless RUBY_VERSION.match(/^1/)
|
45
48
|
spec.add_development_dependency 'pry'
|
@@ -259,7 +259,7 @@ describe Ably::Realtime::Client, :event_machine do
|
|
259
259
|
|
260
260
|
it 'provides paging' do
|
261
261
|
10.times do
|
262
|
-
subject.rest_client.request(:post, "/channels/#{channel_name}/publish", {}, { 'name'
|
262
|
+
subject.rest_client.request(:post, "/channels/#{channel_name}/publish", {}, { 'name' => 'test' })
|
263
263
|
end
|
264
264
|
|
265
265
|
subject.request(:get, "/channels/#{channel_name}/messages", { limit: 2 }).callback do |response|
|
@@ -360,10 +360,7 @@ describe Ably::Rest::Channel do
|
|
360
360
|
let(:channel_name) { "persisted:#{random_str(4)}" }
|
361
361
|
let(:channel) { client.channel(channel_name) }
|
362
362
|
let(:endpoint) do
|
363
|
-
client.endpoint
|
364
|
-
client_end_point.user = key_name
|
365
|
-
client_end_point.password = key_secret
|
366
|
-
end
|
363
|
+
client.endpoint
|
367
364
|
end
|
368
365
|
let(:default_history_options) do
|
369
366
|
{
|
@@ -111,7 +111,7 @@ describe Ably::Rest::Client do
|
|
111
111
|
let(:client_options) { default_options.merge(key: api_key) }
|
112
112
|
|
113
113
|
let!(:get_message_history_stub) do
|
114
|
-
stub_request(:get, "https://#{
|
114
|
+
stub_request(:get, "https://#{environment}-#{Ably::Rest::Client::DOMAIN}/channels/#{channel_name}/messages?#{history_querystring}").
|
115
115
|
to_return(body: [], headers: { 'Content-Type' => 'application/json' })
|
116
116
|
end
|
117
117
|
|
@@ -284,7 +284,7 @@ describe Ably::Rest::Client do
|
|
284
284
|
context 'when environment is NOT production' do
|
285
285
|
let(:client_options) { default_options.merge(environment: 'sandbox', key: api_key) }
|
286
286
|
let!(:default_host_request_stub) do
|
287
|
-
stub_request(:post, "https://#{
|
287
|
+
stub_request(:post, "https://#{environment}-#{Ably::Rest::Client::DOMAIN}#{path}").to_return do
|
288
288
|
raise Faraday::TimeoutError.new('timeout error message')
|
289
289
|
end
|
290
290
|
end
|
@@ -313,16 +313,16 @@ describe Ably::Rest::Client do
|
|
313
313
|
end
|
314
314
|
|
315
315
|
let!(:first_fallback_request_stub) do
|
316
|
-
stub_request(:post, "https://#{
|
316
|
+
stub_request(:post, "https://#{custom_hosts[0]}#{path}").to_return(&fallback_block)
|
317
317
|
end
|
318
318
|
|
319
319
|
let!(:second_fallback_request_stub) do
|
320
|
-
stub_request(:post, "https://#{
|
320
|
+
stub_request(:post, "https://#{custom_hosts[1]}#{path}").to_return(&fallback_block)
|
321
321
|
end
|
322
322
|
|
323
323
|
context 'and connection times out' do
|
324
324
|
let!(:default_host_request_stub) do
|
325
|
-
stub_request(:post, "https://#{
|
325
|
+
stub_request(:post, "https://#{Ably::Rest::Client::DOMAIN}#{path}").to_return do
|
326
326
|
raise Faraday::TimeoutError.new('timeout error message')
|
327
327
|
end
|
328
328
|
end
|
@@ -336,7 +336,7 @@ describe Ably::Rest::Client do
|
|
336
336
|
|
337
337
|
context "and the total request time exeeds #{http_defaults.fetch(:max_retry_duration)} seconds" do
|
338
338
|
let!(:default_host_request_stub) do
|
339
|
-
stub_request(:post, "https://#{
|
339
|
+
stub_request(:post, "https://#{Ably::Rest::Client::DOMAIN}#{path}").to_return do
|
340
340
|
sleep max_retry_duration * 1.5
|
341
341
|
raise Faraday::TimeoutError.new('timeout error message')
|
342
342
|
end
|
@@ -353,7 +353,7 @@ describe Ably::Rest::Client do
|
|
353
353
|
|
354
354
|
context 'and connection fails' do
|
355
355
|
let!(:default_host_request_stub) do
|
356
|
-
stub_request(:post, "https://#{
|
356
|
+
stub_request(:post, "https://#{Ably::Rest::Client::DOMAIN}#{path}").to_return do
|
357
357
|
raise Faraday::ConnectionFailed.new('connection failure error message')
|
358
358
|
end
|
359
359
|
end
|
@@ -369,7 +369,7 @@ describe Ably::Rest::Client do
|
|
369
369
|
context 'and basic authentication fails' do
|
370
370
|
let(:status) { 401 }
|
371
371
|
let!(:default_host_request_stub) do
|
372
|
-
stub_request(:post, "https://#{
|
372
|
+
stub_request(:post, "https://#{Ably::Rest::Client::DOMAIN}#{path}").to_return(
|
373
373
|
headers: { 'Content-Type' => 'application/json' },
|
374
374
|
status: status,
|
375
375
|
body: {
|
@@ -401,7 +401,7 @@ describe Ably::Rest::Client do
|
|
401
401
|
end
|
402
402
|
end
|
403
403
|
let!(:default_host_request_stub) do
|
404
|
-
stub_request(:post, "https://#{
|
404
|
+
stub_request(:post, "https://#{Ably::Rest::Client::DOMAIN}#{path}").to_return(&fallback_block)
|
405
405
|
end
|
406
406
|
|
407
407
|
it 'attempts the fallback hosts as this is an authentication failure' do
|
@@ -437,16 +437,16 @@ describe Ably::Rest::Client do
|
|
437
437
|
end
|
438
438
|
end
|
439
439
|
let!(:default_host_request_stub) do
|
440
|
-
stub_request(:post, "https://#{
|
440
|
+
stub_request(:post, "https://#{Ably::Rest::Client::DOMAIN}#{path}").to_return(&fallback_block)
|
441
441
|
end
|
442
442
|
|
443
443
|
context 'with custom fallback hosts provided' do
|
444
444
|
let!(:first_fallback_request_stub) do
|
445
|
-
stub_request(:post, "https://#{
|
445
|
+
stub_request(:post, "https://#{custom_hosts[0]}#{path}").to_return(&fallback_block)
|
446
446
|
end
|
447
447
|
|
448
448
|
let!(:second_fallback_request_stub) do
|
449
|
-
stub_request(:post, "https://#{
|
449
|
+
stub_request(:post, "https://#{custom_hosts[1]}#{path}").to_return(&fallback_block)
|
450
450
|
end
|
451
451
|
|
452
452
|
let(:client_options) {
|
@@ -619,16 +619,16 @@ describe Ably::Rest::Client do
|
|
619
619
|
end
|
620
620
|
end
|
621
621
|
let!(:default_host_request_stub) do
|
622
|
-
stub_request(:post, "https://#{
|
622
|
+
stub_request(:post, "https://#{env}-#{Ably::Rest::Client::DOMAIN}#{path}").to_return(&fallback_block)
|
623
623
|
end
|
624
624
|
|
625
625
|
context 'with custom fallback hosts provided (#RSC15b, #TO3k6)' do
|
626
626
|
let!(:first_fallback_request_stub) do
|
627
|
-
stub_request(:post, "https://#{
|
627
|
+
stub_request(:post, "https://#{custom_hosts[0]}#{path}").to_return(&fallback_block)
|
628
628
|
end
|
629
629
|
|
630
630
|
let!(:second_fallback_request_stub) do
|
631
|
-
stub_request(:post, "https://#{
|
631
|
+
stub_request(:post, "https://#{custom_hosts[1]}#{path}").to_return(&fallback_block)
|
632
632
|
end
|
633
633
|
|
634
634
|
let(:client_options) {
|
@@ -666,11 +666,11 @@ describe Ably::Rest::Client do
|
|
666
666
|
}
|
667
667
|
|
668
668
|
let!(:first_fallback_request_stub) do
|
669
|
-
stub_request(:post, "https://#{
|
669
|
+
stub_request(:post, "https://#{Ably::FALLBACK_HOSTS[0]}#{path}").to_return(&fallback_block)
|
670
670
|
end
|
671
671
|
|
672
672
|
let!(:second_fallback_request_stub) do
|
673
|
-
stub_request(:post, "https://#{
|
673
|
+
stub_request(:post, "https://#{Ably::FALLBACK_HOSTS[1]}#{path}").to_return(&fallback_block)
|
674
674
|
end
|
675
675
|
|
676
676
|
let(:client_options) {
|
@@ -701,7 +701,7 @@ describe Ably::Rest::Client do
|
|
701
701
|
let(:path) { '/channels/test/publish' }
|
702
702
|
|
703
703
|
let!(:custom_host_request_stub) do
|
704
|
-
stub_request(:post, "https://#{
|
704
|
+
stub_request(:post, "https://#{custom_host}#{path}").to_return do
|
705
705
|
raise Faraday::ConnectionFailed.new('connection failure error message')
|
706
706
|
end
|
707
707
|
end
|
@@ -840,7 +840,7 @@ describe Ably::Rest::Client do
|
|
840
840
|
lib << Ably::VERSION
|
841
841
|
|
842
842
|
|
843
|
-
stub_request(:post, "#{client.endpoint
|
843
|
+
stub_request(:post, "#{client.endpoint}/channels/foo/publish").
|
844
844
|
with(headers: {
|
845
845
|
'X-Ably-Version' => Ably::PROTOCOL_VERSION,
|
846
846
|
'X-Ably-Lib' => lib.join('-')
|
@@ -881,7 +881,7 @@ describe Ably::Rest::Client do
|
|
881
881
|
|
882
882
|
it 'provides paging' do
|
883
883
|
10.times do
|
884
|
-
client.request(:post, "/channels/#{channel_name}/publish", {}, { 'name'
|
884
|
+
client.request(:post, "/channels/#{channel_name}/publish", {}, { 'name' => 'test' })
|
885
885
|
end
|
886
886
|
response = client.request(:get, "/channels/#{channel_name}/messages", { limit: 2 })
|
887
887
|
expect(response.items.length).to eql(2)
|
@@ -69,10 +69,7 @@ describe Ably::Rest::Presence do
|
|
69
69
|
}
|
70
70
|
end
|
71
71
|
let(:endpoint) do
|
72
|
-
client.endpoint
|
73
|
-
client_end_point.user = key_name
|
74
|
-
client_end_point.password = key_secret
|
75
|
-
end
|
72
|
+
client.endpoint
|
76
73
|
end
|
77
74
|
let!(:get_stub) {
|
78
75
|
query_params = query_options.map { |k, v| "#{k}=#{v}" }.join('&')
|
@@ -182,10 +179,7 @@ describe Ably::Rest::Presence do
|
|
182
179
|
let(:user) { 'appid.keyuid' }
|
183
180
|
let(:secret) { random_str(8) }
|
184
181
|
let(:endpoint) do
|
185
|
-
client.endpoint
|
186
|
-
client_end_point.user = user
|
187
|
-
client_end_point.password = secret
|
188
|
-
end
|
182
|
+
client.endpoint
|
189
183
|
end
|
190
184
|
let(:client) do
|
191
185
|
Ably::Rest::Client.new(key: "#{user}:#{secret}")
|
@@ -310,10 +304,7 @@ describe Ably::Rest::Presence do
|
|
310
304
|
let(:user) { 'appid.keyuid' }
|
311
305
|
let(:secret) { random_str(8) }
|
312
306
|
let(:endpoint) do
|
313
|
-
client.endpoint
|
314
|
-
client_end_point.user = user
|
315
|
-
client_end_point.password = secret
|
316
|
-
end
|
307
|
+
client.endpoint
|
317
308
|
end
|
318
309
|
let(:client) do
|
319
310
|
Ably::Rest::Client.new(client_options.merge(key: "#{user}:#{secret}"))
|
@@ -4,8 +4,10 @@ def console(message)
|
|
4
4
|
puts "\033[31m[#{Time.now.strftime('%H:%M:%S.%L')}]\033[0m \033[33m#{message}\033[0m"
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
unless RUBY_VERSION.match(/^1/)
|
8
|
+
require 'coveralls'
|
9
|
+
Coveralls.wear!
|
10
|
+
end
|
9
11
|
|
10
12
|
require 'webmock/rspec'
|
11
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ably-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew O'Riordan
|
@@ -84,30 +84,30 @@ dependencies:
|
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '11.3'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '11.3'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: redcarpet
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.3'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.3'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,44 +126,44 @@ dependencies:
|
|
126
126
|
name: rspec-retry
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '0.4'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
138
|
+
version: '0.4'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: yard
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
145
|
+
version: '0.9'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
152
|
+
version: '0.9'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: webmock
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
159
|
+
version: '2.0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
166
|
+
version: '2.0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: pry
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -405,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
405
405
|
version: '0'
|
406
406
|
requirements: []
|
407
407
|
rubyforge_project:
|
408
|
-
rubygems_version: 2.
|
408
|
+
rubygems_version: 2.5.1
|
409
409
|
signing_key:
|
410
410
|
specification_version: 4
|
411
411
|
summary: A Ruby REST only client library for ably.io realtime messaging
|
@@ -417,4 +417,3 @@ test_files:
|
|
417
417
|
- spec/unit/modules_spec.rb
|
418
418
|
- spec/unit/rest_spec.rb
|
419
419
|
- spec/unit/util_spec.rb
|
420
|
-
has_rdoc:
|