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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38bd014146636fd9c6391b41865c96bb42428a93
4
- data.tar.gz: f3c693d69c50f0a2ae77782d901e4ae0d00752b5
3
+ metadata.gz: 026aba274be988390f8f1a01b92461b6262da5f6
4
+ data.tar.gz: 6336a90c4789ea3f511bc96f699e88144afffe88
5
5
  SHA512:
6
- metadata.gz: 5f07d67f3764e8b6083b3b066492ef6fa69ece6943d5fbf82469f5af720be96eed21539741b482b79c0c9c373d17d866e3d2a3f1473687cb36b89d88c5204a21
7
- data.tar.gz: a196e0fa9929e64e76cf689dcfb4c5ab9527b08b03696dc2c806876dcb3760ec93f212f90439963d80dba348d8e1dc568fbc2e6825c2415b5906c0d81938b553
6
+ metadata.gz: 13b2deadacbbf904a5f0e6f80a6a9d359dab6fea77866e219d18d29ba97c263b350fa88a305c86424105fe69e70e781bfad77559a39196f75b3f9ff264fa76f7
7
+ data.tar.gz: 99501a69f114fe0359bffa1281fec7e01cf447b5f8abdfe5a845b07943b9daac2c25f67f434b32b45b60f239bb279684ebabc65bb2dad26a3265ff78e9fdd059
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- LITA RingCentral Adapter
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
- ### Example
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
- ### Change Log
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
- LITA RingCentral Adapter is available under the MIT license. See [LICENSE.txt](LICENSE.txt) for details.
85
+ Lita RingCentral Adapter is available under the MIT license. See [LICENSE.txt](LICENSE.txt) for details.
64
86
 
65
- LITA RingCentral Adapter © 2016 by John Wang
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, room: user_phone_number
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.debug('Authenticating with RingCentral.')
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,
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-ringcentral'
3
- spec.date = '2016-08-23'
4
- spec.version = '0.0.1'
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.0.0'
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
@@ -1,4 +1,4 @@
1
1
  en:
2
2
  lita:
3
3
  adapters:
4
- ringcentralsms:
4
+ ringcentral:
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.1
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-08-23 00:00:00.000000000 Z
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.0.0
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.0.0
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