ably-rest 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.gitmodules +3 -0
- data/.yardopts +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +70 -0
- data/Rakefile +4 -0
- data/ably-rest.gemspec +31 -0
- data/lib/ably-rest.rb +21 -0
- data/lib/ably-rest/modules/eventmachine_deferrable.rb +23 -0
- data/spec/acceptance/other_spec.rb +3 -0
- data/spec/acceptance/rest_spec.rb +3 -0
- data/spec/integration/modules_spec.rb +3 -0
- data/spec/integration/rest_spec.rb +3 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/unit/models_spec.rb +3 -0
- data/spec/unit/modules_spec.rb +3 -0
- data/spec/unit/rest_spec.rb +3 -0
- metadata +198 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5044494ea34ec804ab8cf1587b543d9689c659aa
|
4
|
+
data.tar.gz: e9e4874dcc1a13c5a949b90a2b131b5213314c9a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 535aa64d8fedfbc0474c26e8e8cf3e9a11badb98396c54a8377f209e0b3c24a6706231e1f5978c12c5036a75f67d5300b52da7f1ea0ccb8054d689e74b330a29
|
7
|
+
data.tar.gz: a075b7979f4762bfd39b80b8ca5a6db3546826c59c6530456baefef0bbfc03e476bc8264427cb8c60442001b17b1fe165e0e89192c4ef4771001468ade05d018
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ably
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# [Ably](https://ably.io)
|
2
|
+
|
3
|
+
A Ruby REST client library for [ably.io](https://ably.io), the real-time messaging service.
|
4
|
+
|
5
|
+
Note: This library was created solely for developers who do not want EventMachine as a dependency of their application. If this is not a requirement for you, then we recommended you use the combined [REST & Real-time gem](https://rubygems.org/gems/ably).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
The client library is available as a [gem from RubyGems.org](https://rubygems.org/gems/ably-rest).
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'ably-rest'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ably-rest
|
22
|
+
|
23
|
+
## Using the REST API
|
24
|
+
|
25
|
+
### Publishing a message to a channel
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
client = Ably::Rest.new(api_key: "xxxxx")
|
29
|
+
channel = client.channel("test")
|
30
|
+
channel.publish("myEvent", "Hello!") #=> true
|
31
|
+
```
|
32
|
+
|
33
|
+
### Fetching a channel's history
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
client = Ably::Rest.new(api_key: "xxxxx")
|
37
|
+
channel = client.channel("test")
|
38
|
+
channel.history #=> [{:name=>"test", :data=>"payload"}]
|
39
|
+
```
|
40
|
+
|
41
|
+
### Authentication with a token
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
client = Ably::Rest.new(api_key: "xxxxx")
|
45
|
+
client.auth.authorise # creates a token and will use token authentication moving forwards
|
46
|
+
client.auth.current_token #=> #<Ably::Models::Token>
|
47
|
+
channel.publish("myEvent", "Hello!") #=> true, sent using token authentication
|
48
|
+
```
|
49
|
+
|
50
|
+
### Fetching your application's stats
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
client = Ably::Rest.new(api_key: "xxxxx")
|
54
|
+
client.stats #=> [{:channels=>..., :apiRequests=>..., ...}]
|
55
|
+
```
|
56
|
+
|
57
|
+
### Fetching the Ably service time
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
client = Ably::Rest.new(api_key: "xxxxx")
|
61
|
+
client.time #=> 2013-12-12 14:23:34 +0000
|
62
|
+
```
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/ably-rest.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib/submodules/ably-ruby/lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ably/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ably-rest"
|
8
|
+
spec.version = Ably::VERSION
|
9
|
+
spec.authors = ["Matthew O'Riordan"]
|
10
|
+
spec.email = ["matt@ably.io"]
|
11
|
+
spec.description = %q{A Ruby REST only client library for ably.io, the real-time messaging service}
|
12
|
+
spec.summary = %q{A Ruby REST only client library for ably.io, the real-time messaging service}
|
13
|
+
spec.homepage = "http://github.com/ably/ably-ruby-rest"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "faraday", "~> 0.9"
|
22
|
+
spec.add_runtime_dependency "json"
|
23
|
+
spec.add_runtime_dependency "msgpack", "~> 0.5"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "redcarpet"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.add_development_dependency "yard"
|
30
|
+
spec.add_development_dependency "webmock"
|
31
|
+
end
|
data/lib/ably-rest.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.unshift File.expand_path(File.dirname(__FILE__), 'submodules/ably-ruby/lib')
|
2
|
+
|
3
|
+
%w(modules util).each do |namespace|
|
4
|
+
Dir.glob(File.expand_path("submodules/ably-ruby/lib/ably/#{namespace}/*.rb", File.dirname(__FILE__))).each do |file|
|
5
|
+
require file
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'ably/auth'
|
10
|
+
require 'ably/exceptions'
|
11
|
+
require 'ably-rest/modules/eventmachine_deferrable'
|
12
|
+
require 'ably/rest'
|
13
|
+
require 'ably/version'
|
14
|
+
|
15
|
+
# Ably is the base namespace for the Ably {Ably::Rest Rest} client libraries.
|
16
|
+
#
|
17
|
+
# Please refer to the {file:README.md Readme} on getting started.
|
18
|
+
#
|
19
|
+
# @see file:README.md README
|
20
|
+
module Ably
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Ably
|
2
|
+
module Models
|
3
|
+
class Message
|
4
|
+
# REST library does not depend on EventMachine::Deferrable, empty module will be used instead
|
5
|
+
module EventMachine
|
6
|
+
module Deferrable
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Ably
|
14
|
+
module Models
|
15
|
+
class PresenceMessage
|
16
|
+
# REST library does not depend on EventMachine::Deferrable, empty module will be used instead
|
17
|
+
module EventMachine
|
18
|
+
module Deferrable
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require 'webmock/rspec'
|
9
|
+
|
10
|
+
require 'ably-rest'
|
11
|
+
|
12
|
+
$:.push File.expand_path('../lib/submodules/ably-ruby/spec', File.dirname(__FILE__))
|
13
|
+
|
14
|
+
require 'support/api_helper'
|
15
|
+
require 'support/event_machine_helper'
|
16
|
+
|
17
|
+
require 'rspec_config'
|
18
|
+
|
19
|
+
def require_tests_from(path)
|
20
|
+
Dir.glob(File.expand_path("../lib/submodules/ably-ruby/spec/#{path}/*.rb", File.dirname(__FILE__))).each do |file|
|
21
|
+
require file
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ably-rest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthew O'Riordan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: msgpack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: redcarpet
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: A Ruby REST only client library for ably.io, the real-time messaging
|
140
|
+
service
|
141
|
+
email:
|
142
|
+
- matt@ably.io
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".gitmodules"
|
149
|
+
- ".yardopts"
|
150
|
+
- Gemfile
|
151
|
+
- LICENSE.txt
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- ably-rest.gemspec
|
155
|
+
- lib/ably-rest.rb
|
156
|
+
- lib/ably-rest/modules/eventmachine_deferrable.rb
|
157
|
+
- spec/acceptance/other_spec.rb
|
158
|
+
- spec/acceptance/rest_spec.rb
|
159
|
+
- spec/integration/modules_spec.rb
|
160
|
+
- spec/integration/rest_spec.rb
|
161
|
+
- spec/spec_helper.rb
|
162
|
+
- spec/unit/models_spec.rb
|
163
|
+
- spec/unit/modules_spec.rb
|
164
|
+
- spec/unit/rest_spec.rb
|
165
|
+
homepage: http://github.com/ably/ably-ruby-rest
|
166
|
+
licenses:
|
167
|
+
- MIT
|
168
|
+
metadata: {}
|
169
|
+
post_install_message:
|
170
|
+
rdoc_options: []
|
171
|
+
require_paths:
|
172
|
+
- lib
|
173
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
requirements: []
|
184
|
+
rubyforge_project:
|
185
|
+
rubygems_version: 2.2.2
|
186
|
+
signing_key:
|
187
|
+
specification_version: 4
|
188
|
+
summary: A Ruby REST only client library for ably.io, the real-time messaging service
|
189
|
+
test_files:
|
190
|
+
- spec/acceptance/other_spec.rb
|
191
|
+
- spec/acceptance/rest_spec.rb
|
192
|
+
- spec/integration/modules_spec.rb
|
193
|
+
- spec/integration/rest_spec.rb
|
194
|
+
- spec/spec_helper.rb
|
195
|
+
- spec/unit/models_spec.rb
|
196
|
+
- spec/unit/modules_spec.rb
|
197
|
+
- spec/unit/rest_spec.rb
|
198
|
+
has_rdoc:
|