ably-rest 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ably-rest.gemspec +14 -19
- data/lib/submodules/ably-ruby/.github/workflows/check.yml +13 -4
- data/lib/submodules/ably-ruby/CHANGELOG.md +8 -0
- data/lib/submodules/ably-ruby/ably.gemspec +1 -0
- data/lib/submodules/ably-ruby/lib/ably/models/channel_details.rb +59 -0
- data/lib/submodules/ably-ruby/lib/ably/models/channel_metrics.rb +84 -0
- data/lib/submodules/ably-ruby/lib/ably/models/channel_occupancy.rb +43 -0
- data/lib/submodules/ably-ruby/lib/ably/models/channel_status.rb +53 -0
- data/lib/submodules/ably-ruby/lib/ably/rest/channel.rb +7 -0
- data/lib/submodules/ably-ruby/lib/ably/version.rb +1 -1
- data/lib/submodules/ably-ruby/spec/acceptance/rest/channel_spec.rb +18 -0
- data/lib/submodules/ably-ruby/spec/unit/models/channel_details_spec.rb +30 -0
- data/lib/submodules/ably-ruby/spec/unit/models/channel_metrics_spec.rb +42 -0
- data/lib/submodules/ably-ruby/spec/unit/models/channel_occupancy_spec.rb +17 -0
- data/lib/submodules/ably-ruby/spec/unit/models/channel_status_spec.rb +36 -0
- metadata +56 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47921b2d2dd22a48024cbd984f6e469ac9b17d8c12bf175c83e7efb9e9c7f6a7
|
4
|
+
data.tar.gz: b0059ac593762b581f1bafb6cf6078a771efefdf0030e4fe7e188cb34db0e175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37ff9f69ddc711ee793ecb18fd57b0e75ede1f8df72d7015949824cda28522f0926318a6b71b1c7aaca31720dbfd9b172ea8ad542be46080d4adf3bcbe2e4285
|
7
|
+
data.tar.gz: e3f1ab29667419b0958550f72785bfadbf5565bf779dc88b113ddb9db7e526dc33241d4dc6434ce2d15c09e0ee18c87cf6a62a9d0c9770303f0c643032316f7f
|
data/ably-rest.gemspec
CHANGED
@@ -31,33 +31,28 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
32
32
|
spec.require_paths = ['lib']
|
33
33
|
|
34
|
-
spec.add_runtime_dependency 'faraday', '~>
|
34
|
+
spec.add_runtime_dependency 'faraday', '~> 2.2'
|
35
35
|
spec.add_runtime_dependency 'excon', '~> 0.55'
|
36
36
|
spec.add_runtime_dependency 'typhoeus', '~> 1.4'
|
37
|
+
spec.add_runtime_dependency 'faraday-typhoeus', '~> 0.2.0'
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
else
|
41
|
-
spec.add_runtime_dependency 'json'
|
42
|
-
end
|
43
|
-
spec.add_runtime_dependency 'msgpack', '>= 0.6.2'
|
39
|
+
spec.add_runtime_dependency 'json'
|
40
|
+
spec.add_runtime_dependency 'msgpack', '=1.5.2'
|
44
41
|
spec.add_runtime_dependency 'addressable', '>= 2.0.0'
|
45
42
|
|
46
43
|
spec.add_development_dependency 'bundler', '>= 1.3.0'
|
47
|
-
spec.add_development_dependency 'rake', '~>
|
44
|
+
spec.add_development_dependency 'rake', '~> 13.0.6'
|
48
45
|
spec.add_development_dependency 'redcarpet', '~> 3.3'
|
49
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
50
|
-
spec.add_development_dependency 'rspec-retry', '~> 0.
|
51
|
-
spec.add_development_dependency 'webrick'
|
46
|
+
spec.add_development_dependency 'rspec', '~> 3.11'
|
47
|
+
spec.add_development_dependency 'rspec-retry', '~> 0.6.2'
|
52
48
|
spec.add_development_dependency 'yard', '~> 0.9'
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
spec.add_development_dependency '
|
61
|
-
spec.add_development_dependency 'pry-byebug'
|
50
|
+
spec.add_development_dependency 'webmock', '~> 3.14.0'
|
51
|
+
spec.add_development_dependency 'coveralls'
|
52
|
+
spec.add_development_dependency 'pry', '~> 0.14.1'
|
53
|
+
spec.add_development_dependency 'pry-byebug'
|
54
|
+
|
55
|
+
if RUBY_VERSION.match(/^3\./)
|
56
|
+
spec.add_development_dependency 'webrick', '~> 1.7.0'
|
62
57
|
end
|
63
58
|
end
|
@@ -12,6 +12,7 @@ jobs:
|
|
12
12
|
matrix:
|
13
13
|
ruby: [ '2.7', '3.0', '3.1' ]
|
14
14
|
protocol: [ 'json', 'msgpack' ]
|
15
|
+
type: [ 'unit', 'acceptance' ]
|
15
16
|
steps:
|
16
17
|
- uses: actions/checkout@v2
|
17
18
|
with:
|
@@ -20,15 +21,23 @@ jobs:
|
|
20
21
|
with:
|
21
22
|
ruby-version: ${{ matrix.ruby }}
|
22
23
|
bundler-cache: true
|
23
|
-
-
|
24
|
-
|
24
|
+
- name: 'Run ${{ matrix.type }} tests on ruby ${{ matrix.ruby }} (${{ matrix.protocol }} protocol)'
|
25
|
+
env:
|
25
26
|
PARALLEL_TEST_PROCESSORS: 2
|
27
|
+
RSPEC_RETRY: true
|
26
28
|
PROTOCOL: ${{ matrix.protocol }}
|
27
|
-
run:
|
29
|
+
run: bundle exec parallel_rspec --prefix-output-with-test-env-number -- --format documentation --format RspecJunitFormatter --out ${{ matrix.protocol }}-${{ matrix.type }}-ruby-${{ matrix.ruby }}.junit -- spec/${{ matrix.type }}
|
30
|
+
- name: Upload test results
|
31
|
+
if: always()
|
32
|
+
uses: ably-labs/test-observability-action@main
|
33
|
+
with:
|
34
|
+
server-url: 'https://test-observability.herokuapp.com'
|
35
|
+
server-auth: ${{ secrets.TEST_OBSERVABILITY_SERVER_AUTH_KEY }}
|
36
|
+
path: '.'
|
28
37
|
- uses: coverallsapp/github-action@1.1.3
|
29
38
|
with:
|
30
39
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
31
|
-
flag-name:
|
40
|
+
flag-name: ruby-${{ matrix.ruby }}-${{ matrix.protocol }}-${{ matrix.type }}
|
32
41
|
parallel: true
|
33
42
|
finish:
|
34
43
|
needs: check
|
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.2.2](https://github.com/ably/ably-ruby/tree/v1.2.2)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.2.1...v1.2.2)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add support to get channel lifecycle status [\#362](https://github.com/ably/ably-ruby/issues/362)
|
10
|
+
|
3
11
|
## [v1.2.1](https://github.com/ably/ably-ruby/tree/v1.2.1)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/ably/ably-ruby/compare/v1.2.0...v1.2.1)
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'rake', '~> 13.0'
|
33
33
|
spec.add_development_dependency 'redcarpet', '~> 3.3'
|
34
34
|
spec.add_development_dependency 'rspec', '~> 3.11.0'
|
35
|
+
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.5.1'
|
35
36
|
spec.add_development_dependency 'rspec-retry', '~> 0.6'
|
36
37
|
spec.add_development_dependency 'yard', '~> 0.9'
|
37
38
|
spec.add_development_dependency 'rspec-instafail', '~> 1.0'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Ably::Models
|
2
|
+
# Convert token details argument to a {ChannelDetails} object
|
3
|
+
#
|
4
|
+
# @param attributes (see #initialize)
|
5
|
+
#
|
6
|
+
# @return [ChannelDetails]
|
7
|
+
def self.ChannelDetails(attributes)
|
8
|
+
case attributes
|
9
|
+
when ChannelDetails
|
10
|
+
return attributes
|
11
|
+
else
|
12
|
+
ChannelDetails.new(attributes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# ChannelDetails is a type that represents information for a channel including channelId, name, status and occupancy (CHD1)
|
17
|
+
#
|
18
|
+
class ChannelDetails
|
19
|
+
extend Ably::Modules::Enum
|
20
|
+
extend Forwardable
|
21
|
+
include Ably::Modules::ModelCommon
|
22
|
+
|
23
|
+
# The attributes of ChannelDetails (CHD2)
|
24
|
+
#
|
25
|
+
attr_reader :attributes
|
26
|
+
|
27
|
+
alias_method :to_h, :attributes
|
28
|
+
|
29
|
+
# Initialize a new ChannelDetails
|
30
|
+
#
|
31
|
+
def initialize(attrs)
|
32
|
+
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
33
|
+
end
|
34
|
+
|
35
|
+
# The identifier of the channel (CHD2a)
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
def channel_id
|
40
|
+
attributes[:channel_id]
|
41
|
+
end
|
42
|
+
|
43
|
+
# The identifier of the channel (CHD2a)
|
44
|
+
#
|
45
|
+
# @return [String]
|
46
|
+
#
|
47
|
+
def name
|
48
|
+
attributes[:name]
|
49
|
+
end
|
50
|
+
|
51
|
+
# The status of the channel (CHD2b)
|
52
|
+
#
|
53
|
+
# @return [Ably::Models::ChannelStatus, nil]
|
54
|
+
#
|
55
|
+
def status
|
56
|
+
Ably::Models::ChannelStatus(attributes[:status])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Ably::Models
|
2
|
+
# Convert token details argument to a {ChannelMetrics} object
|
3
|
+
#
|
4
|
+
# @param attributes (see #initialize)
|
5
|
+
#
|
6
|
+
# @return [ChannelMetrics]
|
7
|
+
def self.ChannelMetrics(attributes)
|
8
|
+
case attributes
|
9
|
+
when ChannelMetrics
|
10
|
+
return attributes
|
11
|
+
else
|
12
|
+
ChannelMetrics.new(attributes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# ChannelMetrics is a type that contains the count of publishers and subscribers, connections and presenceConnections,
|
17
|
+
# presenceMembers and presenceSubscribers (CHM1)
|
18
|
+
#
|
19
|
+
class ChannelMetrics
|
20
|
+
extend Ably::Modules::Enum
|
21
|
+
extend Forwardable
|
22
|
+
include Ably::Modules::ModelCommon
|
23
|
+
|
24
|
+
# The attributes of ChannelMetrics (CHM2)
|
25
|
+
#
|
26
|
+
attr_reader :attributes
|
27
|
+
|
28
|
+
alias_method :to_h, :attributes
|
29
|
+
|
30
|
+
# Initialize a new ChannelMetrics
|
31
|
+
#
|
32
|
+
def initialize(attrs)
|
33
|
+
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
34
|
+
end
|
35
|
+
|
36
|
+
# The total number of connections to the channel (CHM2a)
|
37
|
+
#
|
38
|
+
# @return [Integer]
|
39
|
+
#
|
40
|
+
def connections
|
41
|
+
attributes[:connections]
|
42
|
+
end
|
43
|
+
|
44
|
+
# The total number of presence connections to the channel (CHM2b)
|
45
|
+
#
|
46
|
+
# @return [Integer]
|
47
|
+
#
|
48
|
+
def presence_connections
|
49
|
+
attributes[:presence_connections]
|
50
|
+
end
|
51
|
+
|
52
|
+
# The total number of presence members for the channel (CHM2c)
|
53
|
+
#
|
54
|
+
# @return [Integer]
|
55
|
+
#
|
56
|
+
def presence_members
|
57
|
+
attributes[:presence_members]
|
58
|
+
end
|
59
|
+
|
60
|
+
# The total number of presence subscribers for the channel (CHM2d)
|
61
|
+
#
|
62
|
+
# @return [Integer]
|
63
|
+
#
|
64
|
+
def presence_subscribers
|
65
|
+
attributes[:presence_subscribers]
|
66
|
+
end
|
67
|
+
|
68
|
+
# The total number of publishers to the channel (CHM2e)
|
69
|
+
#
|
70
|
+
# @return [Integer]
|
71
|
+
#
|
72
|
+
def publishers
|
73
|
+
attributes[:publishers]
|
74
|
+
end
|
75
|
+
|
76
|
+
# The total number of subscribers to the channel (CHM2f)
|
77
|
+
#
|
78
|
+
# @return [Integer]
|
79
|
+
#
|
80
|
+
def subscribers
|
81
|
+
attributes[:subscribers]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Ably::Models
|
2
|
+
# Convert token details argument to a {ChannelOccupancy} object
|
3
|
+
#
|
4
|
+
# @param attributes (see #initialize)
|
5
|
+
#
|
6
|
+
# @return [ChannelOccupancy]
|
7
|
+
def self.ChannelOccupancy(attributes)
|
8
|
+
case attributes
|
9
|
+
when ChannelOccupancy
|
10
|
+
return attributes
|
11
|
+
else
|
12
|
+
ChannelOccupancy.new(attributes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# Type that contain channel metrics (CHO1)
|
17
|
+
#
|
18
|
+
class ChannelOccupancy
|
19
|
+
extend Ably::Modules::Enum
|
20
|
+
extend Forwardable
|
21
|
+
include Ably::Modules::ModelCommon
|
22
|
+
|
23
|
+
# The attributes of ChannelOccupancy (CH02)
|
24
|
+
#
|
25
|
+
attr_reader :attributes
|
26
|
+
|
27
|
+
alias_method :to_h, :attributes
|
28
|
+
|
29
|
+
# Initialize a new ChannelOccupancy
|
30
|
+
#
|
31
|
+
def initialize(attrs)
|
32
|
+
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Metrics object (CHO2a)
|
36
|
+
#
|
37
|
+
# @return [Ably::Models::ChannelMetrics, nil]
|
38
|
+
#
|
39
|
+
def metrics
|
40
|
+
Ably::Models::ChannelMetrics(attributes[:metrics])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Ably::Models
|
2
|
+
# Convert token details argument to a {ChannelStatus} object
|
3
|
+
#
|
4
|
+
# @param attributes (see #initialize)
|
5
|
+
#
|
6
|
+
# @return [ChannelStatus]
|
7
|
+
def self.ChannelStatus(attributes)
|
8
|
+
case attributes
|
9
|
+
when ChannelStatus
|
10
|
+
return attributes
|
11
|
+
else
|
12
|
+
ChannelStatus.new(attributes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# ChannelStatus is a type that contains status and occupancy for a channel (CHS1)
|
17
|
+
#
|
18
|
+
class ChannelStatus
|
19
|
+
extend Ably::Modules::Enum
|
20
|
+
extend Forwardable
|
21
|
+
include Ably::Modules::ModelCommon
|
22
|
+
|
23
|
+
# The attributes of ChannelStatus (CHS2)
|
24
|
+
#
|
25
|
+
attr_reader :attributes
|
26
|
+
|
27
|
+
alias_method :to_h, :attributes
|
28
|
+
|
29
|
+
# Initialize a new ChannelStatus
|
30
|
+
#
|
31
|
+
def initialize(attrs)
|
32
|
+
@attributes = IdiomaticRubyWrapper(attrs.clone)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Represents if the channel is active (CHS2a)
|
36
|
+
#
|
37
|
+
# @return [Boolean]
|
38
|
+
#
|
39
|
+
def is_active
|
40
|
+
attributes[:isActive]
|
41
|
+
end
|
42
|
+
alias_method :active?, :is_active
|
43
|
+
alias_method :is_active?, :is_active
|
44
|
+
|
45
|
+
# Occupancy ChannelOccupancy – occupancy is an object containing the metrics for the channel (CHS2b)
|
46
|
+
#
|
47
|
+
# @return [Ably::Models::ChannelOccupancy, nil]
|
48
|
+
#
|
49
|
+
def occupancy
|
50
|
+
Ably::Models::ChannelOccupancy(attributes[:occupancy])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -161,6 +161,13 @@ module Ably
|
|
161
161
|
end
|
162
162
|
alias options= set_options
|
163
163
|
|
164
|
+
# Makes GET request for channel details (#RSL8, #RSL8a)
|
165
|
+
#
|
166
|
+
# @return [Ably::Models::ChannelDetails]
|
167
|
+
def status
|
168
|
+
Ably::Models::ChannelDetails.new(client.get(base_path).body)
|
169
|
+
end
|
170
|
+
|
164
171
|
private
|
165
172
|
|
166
173
|
def base_path
|
@@ -595,5 +595,23 @@ describe Ably::Rest::Channel do
|
|
595
595
|
expect(channel.presence).to be_a(Ably::Rest::Presence)
|
596
596
|
end
|
597
597
|
end
|
598
|
+
|
599
|
+
context '#status' do
|
600
|
+
let(:channel_name) { "persisted:#{random_str(4)}" }
|
601
|
+
let(:channel) { client.channel(channel_name) }
|
602
|
+
let(:channel_details) { channel.status }
|
603
|
+
|
604
|
+
it 'should return channel details status (#RSL8, #RSL8a)' do
|
605
|
+
expect(channel_details.channel_id).to eq(channel_name)
|
606
|
+
expect(channel_details.name).to eq(channel_name)
|
607
|
+
expect(channel_details.status).to be_a(Ably::Models::ChannelStatus)
|
608
|
+
expect(channel_details.status.is_active).to eq(true)
|
609
|
+
expect(channel_details.status.occupancy.metrics.publishers).to eq(0)
|
610
|
+
expect(channel_details.status.occupancy.metrics.subscribers).to eq(0)
|
611
|
+
expect(channel_details.status.occupancy.metrics.presence_connections).to eq(0)
|
612
|
+
expect(channel_details.status.occupancy.metrics.presence_members).to eq(0)
|
613
|
+
expect(channel_details.status.occupancy.metrics.presence_subscribers).to eq(0)
|
614
|
+
end
|
615
|
+
end
|
598
616
|
end
|
599
617
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'shared/model_behaviour'
|
3
|
+
|
4
|
+
describe Ably::Models::ChannelDetails do
|
5
|
+
subject { Ably::Models::ChannelDetails(channel_id: 'channel-id-123-xyz', name: 'name', status: { isActive: 'true', occupancy: { metrics: { connections: 1, presence_connections: 2, presence_members: 2, presence_subscribers: 5, publishers: 7, subscribers: 9 } } }) }
|
6
|
+
|
7
|
+
describe '#channel_id' do
|
8
|
+
it 'should return channel id' do
|
9
|
+
expect(subject.channel_id).to eq('channel-id-123-xyz')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#name' do
|
14
|
+
it 'should return name' do
|
15
|
+
expect(subject.name).to eq('name')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#status' do
|
20
|
+
it 'should return status' do
|
21
|
+
expect(subject.status).to be_a(Ably::Models::ChannelStatus)
|
22
|
+
expect(subject.status.occupancy.metrics.connections).to eq(1)
|
23
|
+
expect(subject.status.occupancy.metrics.presence_connections).to eq(2)
|
24
|
+
expect(subject.status.occupancy.metrics.presence_members).to eq(2)
|
25
|
+
expect(subject.status.occupancy.metrics.presence_subscribers).to eq(5)
|
26
|
+
expect(subject.status.occupancy.metrics.publishers).to eq(7)
|
27
|
+
expect(subject.status.occupancy.metrics.subscribers).to eq(9)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'shared/model_behaviour'
|
3
|
+
|
4
|
+
describe Ably::Models::ChannelMetrics do
|
5
|
+
subject { Ably::Models::ChannelMetrics(connections: 1, presence_connections: 2, presence_members: 2, presence_subscribers: 5, publishers: 7, subscribers: 9) }
|
6
|
+
|
7
|
+
describe '#connections' do
|
8
|
+
it 'should return integer' do
|
9
|
+
expect(subject.connections).to eq(1)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#presence_connections' do
|
14
|
+
it 'should return integer' do
|
15
|
+
expect(subject.presence_connections).to eq(2)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#presence_members' do
|
20
|
+
it 'should return integer' do
|
21
|
+
expect(subject.presence_members).to eq(2)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#presence_subscribers' do
|
26
|
+
it 'should return integer' do
|
27
|
+
expect(subject.presence_subscribers).to eq(5)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#publishers' do
|
32
|
+
it 'should return integer' do
|
33
|
+
expect(subject.publishers).to eq(7)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#subscribers' do
|
38
|
+
it 'should return integer' do
|
39
|
+
expect(subject.subscribers).to eq(9)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'shared/model_behaviour'
|
3
|
+
|
4
|
+
describe Ably::Models::ChannelOccupancy do
|
5
|
+
subject { Ably::Models::ChannelOccupancy({ metrics: { connections: 1, presence_connections: 2, presence_members: 2, presence_subscribers: 5, publishers: 7, subscribers: 9 } }) }
|
6
|
+
|
7
|
+
describe '#metrics' do
|
8
|
+
it 'should return attributes' do
|
9
|
+
expect(subject.metrics.connections).to eq(1)
|
10
|
+
expect(subject.metrics.presence_connections).to eq(2)
|
11
|
+
expect(subject.metrics.presence_members).to eq(2)
|
12
|
+
expect(subject.metrics.presence_subscribers).to eq(5)
|
13
|
+
expect(subject.metrics.publishers).to eq(7)
|
14
|
+
expect(subject.metrics.subscribers).to eq(9)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'shared/model_behaviour'
|
3
|
+
|
4
|
+
describe Ably::Models::ChannelStatus do
|
5
|
+
subject { Ably::Models::ChannelStatus({ isActive: 'true', occupancy: { metrics: { connections: 1, presence_connections: 2, presence_members: 2, presence_subscribers: 5, publishers: 7, subscribers: 9 } } }) }
|
6
|
+
|
7
|
+
describe '#is_active' do
|
8
|
+
context 'when occupancy is active' do
|
9
|
+
subject { Ably::Models::ChannelStatus({ isActive: true, occupancy: { metrics: { connections: 1, presence_connections: 2, presence_members: 2, presence_subscribers: 5, publishers: 7, subscribers: 9 } } }) }
|
10
|
+
|
11
|
+
it 'should return true' do
|
12
|
+
expect(subject.is_active).to eq(true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when occupancy is not active' do
|
17
|
+
subject { Ably::Models::ChannelStatus({ isActive: false, occupancy: { metrics: { connections: 1, presence_connections: 2, presence_members: 2, presence_subscribers: 5, publishers: 7, subscribers: 9 } } }) }
|
18
|
+
|
19
|
+
it 'should return false' do
|
20
|
+
expect(subject.is_active).to eq(false)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#occupancy' do
|
26
|
+
it 'should return occupancy object' do
|
27
|
+
expect(subject.occupancy).to be_a(Ably::Models::ChannelOccupancy)
|
28
|
+
expect(subject.occupancy.metrics.connections).to eq(1)
|
29
|
+
expect(subject.occupancy.metrics.presence_connections).to eq(2)
|
30
|
+
expect(subject.occupancy.metrics.presence_members).to eq(2)
|
31
|
+
expect(subject.occupancy.metrics.presence_subscribers).to eq(5)
|
32
|
+
expect(subject.occupancy.metrics.publishers).to eq(7)
|
33
|
+
expect(subject.occupancy.metrics.subscribers).to eq(9)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ably-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew O'Riordan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: excon
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday-typhoeus
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: json
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +84,16 @@ dependencies:
|
|
70
84
|
name: msgpack
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - '='
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 1.5.2
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - '='
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 1.5.2
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: addressable
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +128,14 @@ dependencies:
|
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 13.0.6
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 13.0.6
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: redcarpet
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,42 +156,28 @@ dependencies:
|
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 3.
|
159
|
+
version: '3.11'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: 3.
|
166
|
+
version: '3.11'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: rspec-retry
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - "~>"
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: 0.6.2
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - "~>"
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: webrick
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
180
|
+
version: 0.6.2
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: yard
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +198,14 @@ dependencies:
|
|
198
198
|
requirements:
|
199
199
|
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 3.14.0
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 3.14.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: coveralls
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,16 +224,16 @@ dependencies:
|
|
224
224
|
name: pry
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- - "
|
227
|
+
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
229
|
+
version: 0.14.1
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 0.14.1
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: pry-byebug
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +248,20 @@ dependencies:
|
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: webrick
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "~>"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: 1.7.0
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - "~>"
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: 1.7.0
|
251
265
|
description: A Ruby REST only client library for ably.io realtime messaging
|
252
266
|
email:
|
253
267
|
- matt@ably.io
|
@@ -291,8 +305,12 @@ files:
|
|
291
305
|
- lib/submodules/ably-ruby/lib/ably/exceptions.rb
|
292
306
|
- lib/submodules/ably-ruby/lib/ably/logger.rb
|
293
307
|
- lib/submodules/ably-ruby/lib/ably/models/auth_details.rb
|
308
|
+
- lib/submodules/ably-ruby/lib/ably/models/channel_details.rb
|
309
|
+
- lib/submodules/ably-ruby/lib/ably/models/channel_metrics.rb
|
310
|
+
- lib/submodules/ably-ruby/lib/ably/models/channel_occupancy.rb
|
294
311
|
- lib/submodules/ably-ruby/lib/ably/models/channel_options.rb
|
295
312
|
- lib/submodules/ably-ruby/lib/ably/models/channel_state_change.rb
|
313
|
+
- lib/submodules/ably-ruby/lib/ably/models/channel_status.rb
|
296
314
|
- lib/submodules/ably-ruby/lib/ably/models/cipher_params.rb
|
297
315
|
- lib/submodules/ably-ruby/lib/ably/models/connection_details.rb
|
298
316
|
- lib/submodules/ably-ruby/lib/ably/models/connection_state_change.rb
|
@@ -431,7 +449,11 @@ files:
|
|
431
449
|
- lib/submodules/ably-ruby/spec/unit/auth_spec.rb
|
432
450
|
- lib/submodules/ably-ruby/spec/unit/logger_spec.rb
|
433
451
|
- lib/submodules/ably-ruby/spec/unit/models/auth_details_spec.rb
|
452
|
+
- lib/submodules/ably-ruby/spec/unit/models/channel_details_spec.rb
|
453
|
+
- lib/submodules/ably-ruby/spec/unit/models/channel_metrics_spec.rb
|
454
|
+
- lib/submodules/ably-ruby/spec/unit/models/channel_occupancy_spec.rb
|
434
455
|
- lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
|
456
|
+
- lib/submodules/ably-ruby/spec/unit/models/channel_status_spec.rb
|
435
457
|
- lib/submodules/ably-ruby/spec/unit/models/cipher_params_spec.rb
|
436
458
|
- lib/submodules/ably-ruby/spec/unit/models/connection_details_spec.rb
|
437
459
|
- lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
|