lita-ringcentral 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +27 -5
- data/lib/lita/adapters/ringcentral/callback.rb +3 -1
- data/lib/lita/adapters/ringcentral/connector.rb +5 -2
- data/lita-ringcentral.gemspec +5 -5
- data/locales/en.yml +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 026aba274be988390f8f1a01b92461b6262da5f6
|
4
|
+
data.tar.gz: 6336a90c4789ea3f511bc96f699e88144afffe88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13b2deadacbbf904a5f0e6f80a6a9d359dab6fea77866e219d18d29ba97c263b350fa88a305c86424105fe69e70e781bfad77559a39196f75b3f9ff264fa76f7
|
7
|
+
data.tar.gz: 99501a69f114fe0359bffa1281fec7e01cf447b5f8abdfe5a845b07943b9daac2c25f67f434b32b45b60f239bb279684ebabc65bb2dad26a3265ff78e9fdd059
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Lita RingCentral Adapter
|
2
2
|
========================
|
3
3
|
|
4
4
|
[![Gem Version][gem-version-svg]][gem-version-link]
|
@@ -21,22 +21,44 @@ Add `lita-ringcentral` to your Lita instance's Gemfile:
|
|
21
21
|
gem "lita-ringcentral"
|
22
22
|
```
|
23
23
|
|
24
|
-
|
24
|
+
## Configuration
|
25
25
|
|
26
26
|
``` ruby
|
27
27
|
Lita.configure do |config|
|
28
28
|
config.robot.adapter = :ringcentral
|
29
29
|
|
30
|
+
# RingCentral app info
|
30
31
|
config.adapters.ringcentral.app_key = 'my_app_key'
|
31
32
|
config.adapters.ringcentral.app_secret = 'my_app_secret'
|
32
33
|
config.adapters.ringcentral.server = 'my_server'
|
34
|
+
|
35
|
+
# RingCentral user info
|
33
36
|
config.adapters.ringcentral.username = 'my_username'
|
34
37
|
config.adapters.ringcentral.extension = 'my_extension'
|
35
38
|
config.adapters.ringcentral.password = 'my_password'
|
39
|
+
|
40
|
+
# RingCentral bot SMS number available to authorized user
|
41
|
+
config.adapters.ringcentral.sms_number = 'my_sms_number'
|
36
42
|
end
|
37
43
|
```
|
38
44
|
|
39
|
-
###
|
45
|
+
### Notes
|
46
|
+
|
47
|
+
This adapter supports 1:1 communications between a Lita chatbot and a user of SMS. It supports standard communications and does not have special functionality for command routes.
|
48
|
+
|
49
|
+
## Usage
|
50
|
+
|
51
|
+
The bot will listen to and respond from the SMS number provided for `config.adapters.ringcentral.sms_number`.
|
52
|
+
|
53
|
+
## API documentation
|
54
|
+
|
55
|
+
The API documentation, useful for plugin authors, can be found for the latest gem release on [RubyDoc.info](http://www.rubydoc.info/gems/lita-ringcentral).
|
56
|
+
|
57
|
+
## To Do
|
58
|
+
|
59
|
+
1. User address book lookup.
|
60
|
+
|
61
|
+
## Change Log
|
40
62
|
|
41
63
|
See [CHANGELOG.md](CHANGELOG.md)
|
42
64
|
|
@@ -60,9 +82,9 @@ Lita
|
|
60
82
|
|
61
83
|
## License
|
62
84
|
|
63
|
-
|
85
|
+
Lita RingCentral Adapter is available under the MIT license. See [LICENSE.txt](LICENSE.txt) for details.
|
64
86
|
|
65
|
-
|
87
|
+
Lita RingCentral Adapter © 2016 by John Wang
|
66
88
|
|
67
89
|
[gem-version-svg]: https://badge.fury.io/rb/lita-ringcentral.svg
|
68
90
|
[gem-version-link]: http://badge.fury.io/rb/lita-ringcentral
|
@@ -14,10 +14,12 @@ module Lita
|
|
14
14
|
|
15
15
|
def update(message)
|
16
16
|
Lita.logger.info 'Processing RingCentral Message'
|
17
|
+
Lita.logger.info MultiJson.encode message
|
17
18
|
user_phone_number = message['body']['from']['phoneNumber']
|
19
|
+
Lita.logger.info "Message received from #{user_phone_number}"
|
18
20
|
user = Lita::User.find_by_name user_phone_number
|
19
21
|
user = create_user(message['body']['from']) unless user
|
20
|
-
source = Lita::Source.new user: user
|
22
|
+
source = Lita::Source.new user: user #, room: user_phone_number
|
21
23
|
post = message['body']['subject'].to_s
|
22
24
|
msg = Lita::Message.new @robot, post, source
|
23
25
|
@robot.receive msg
|
@@ -22,22 +22,25 @@ module Lita
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def client_connect
|
25
|
-
Lita.logger.
|
25
|
+
Lita.logger.info('Authenticating with RingCentral.')
|
26
26
|
if @token.nil?
|
27
27
|
@client.authorize_password @username, @extension, @password
|
28
28
|
else
|
29
29
|
@client.set_token @token
|
30
30
|
end
|
31
31
|
|
32
|
-
observer = Lita::Adapters::RingCentral::Callback.new @robot
|
33
32
|
@subscription = @client.create_subscription
|
34
33
|
@subscription.subscribe([
|
35
34
|
'/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS'
|
36
35
|
])
|
36
|
+
|
37
|
+
observer = Lita::Adapters::RingCentral::Callback.new @robot
|
37
38
|
@subscription.add_observer observer
|
38
39
|
end
|
39
40
|
|
40
41
|
def message(to_number, strings)
|
42
|
+
Lita.logger.info("Sending message to #{to_number}")
|
43
|
+
Lita.logger.info MultiJson.encode(strings)
|
41
44
|
strings.each do |s|
|
42
45
|
@client.messages.sms.create(
|
43
46
|
from: @sms_number,
|
data/lita-ringcentral.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-ringcentral'
|
3
|
-
spec.date = '2016-
|
4
|
-
spec.version = '0.0.
|
3
|
+
spec.date = '2016-09-04'
|
4
|
+
spec.version = '0.0.2'
|
5
5
|
spec.authors = ['John Wang']
|
6
6
|
spec.email = ["johncwang@gmail.com"]
|
7
|
-
spec.description = %q{A RingCentral adapter for Lita.}
|
8
|
-
spec.summary = %q{A RingCentral adapter for the Lita chat robot.}
|
7
|
+
spec.description = %q{A RingCentral SMS adapter for Lita.}
|
8
|
+
spec.summary = %q{A RingCentral SMS adapter for the Lita chat robot.}
|
9
9
|
spec.homepage = 'https://github.com/grokify/lita-ringcentral'
|
10
10
|
spec.license = 'MIT'
|
11
11
|
spec.metadata = { 'lita_plugin_type' => 'adapter' }
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
18
|
spec.add_runtime_dependency 'lita', '>= 4.4.3'
|
19
|
-
spec.add_runtime_dependency 'ringcentral_sdk', '>= 1.
|
19
|
+
spec.add_runtime_dependency 'ringcentral_sdk', '>= 1.3.2'
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
22
|
spec.add_development_dependency 'pry-byebug'
|
data/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-ringcentral
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.3.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.3.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description: A RingCentral adapter for Lita.
|
139
|
+
description: A RingCentral SMS adapter for Lita.
|
140
140
|
email:
|
141
141
|
- johncwang@gmail.com
|
142
142
|
executables: []
|
@@ -184,7 +184,7 @@ rubyforge_project:
|
|
184
184
|
rubygems_version: 2.5.1
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
|
-
summary: A RingCentral adapter for the Lita chat robot.
|
187
|
+
summary: A RingCentral SMS adapter for the Lita chat robot.
|
188
188
|
test_files:
|
189
189
|
- spec/lita/adapters/ringcentral_spec.rb
|
190
190
|
- spec/spec_helper.rb
|