lita-ringcentral 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 026aba274be988390f8f1a01b92461b6262da5f6
4
- data.tar.gz: 6336a90c4789ea3f511bc96f699e88144afffe88
3
+ metadata.gz: f36ae61d0e3f8f611af772814cef5238ed936124
4
+ data.tar.gz: 76a7190e976c8952ddb96f925795052f43738e27
5
5
  SHA512:
6
- metadata.gz: 13b2deadacbbf904a5f0e6f80a6a9d359dab6fea77866e219d18d29ba97c263b350fa88a305c86424105fe69e70e781bfad77559a39196f75b3f9ff264fa76f7
7
- data.tar.gz: 99501a69f114fe0359bffa1281fec7e01cf447b5f8abdfe5a845b07943b9daac2c25f67f434b32b45b60f239bb279684ebabc65bb2dad26a3265ff78e9fdd059
6
+ metadata.gz: b16053939aad6d81fac3b96b27fa10145eb76999b80ea835c93495cc95499586594fe165003029a1e772b8a85daf0b779862f8d4b32af7bb82cfe1df3b0b3f9b
7
+ data.tar.gz: 39620cc9bd41bb6d37d3345071d898bc02967fd8493cc73e007b7d045bff6f52c4a2eed18aabb52a21c34fd15913c2555719d44539abca62e9c7268dc2d7ff3b
@@ -1,4 +1,10 @@
1
1
  CHANGELOG
2
2
  ---------
3
+ - **2016-09-05**: 0.0.3
4
+ - Add message filtering to ensure we are processing the correct events
5
+ - Add more logging info
6
+ - Update RingCentral SDK version requirement to 1.3.4 from 1.3.2
7
+ - **2016-09-04**: 0.0.2
8
+ - Update RingCentral SDK version requirement to 1.3.2 from 1.0.0
3
9
  - **2016-08-23**: 0.0.1
4
10
  - Initial commit
@@ -6,6 +6,7 @@ module Lita
6
6
 
7
7
  def initialize(robot)
8
8
  @robot = robot
9
+ @logger_prefix = " -- #{self.class.name}: "
9
10
  end
10
11
 
11
12
  def create_user(user_data)
@@ -13,10 +14,18 @@ module Lita
13
14
  end
14
15
 
15
16
  def update(message)
16
- Lita.logger.info 'Processing RingCentral Message'
17
- Lita.logger.info MultiJson.encode message
17
+ m = message
18
+ unless m.is_a?(Hash) && m.key?('event') && m['event'].index('/message-store/instant?type=SMS').is_a?(Fixnum)
19
+ return
20
+ end
21
+ unless m.key?('body') && m['body'].key?('from') && m['body']['from'].key?('phoneNumber')
22
+ return
23
+ end
24
+ Lita.logger.info "#{@logger_prefix}Processing RingCentral Message"
25
+ Lita.logger.info "#{@logger_prefix}" + MultiJson.encode(message)
26
+
18
27
  user_phone_number = message['body']['from']['phoneNumber']
19
- Lita.logger.info "Message received from #{user_phone_number}"
28
+ Lita.logger.info "#{@logger_prefix}Message received from #{user_phone_number}"
20
29
  user = Lita::User.find_by_name user_phone_number
21
30
  user = create_user(message['body']['from']) unless user
22
31
  source = Lita::Source.new user: user #, room: user_phone_number
@@ -15,6 +15,7 @@ module Lita
15
15
  @password = password
16
16
  @token = token
17
17
  @sms_number = sms_number
18
+ @logger_prefix = " -- #{self.class.name}: "
18
19
  end
19
20
 
20
21
  def connect
@@ -22,7 +23,7 @@ module Lita
22
23
  end
23
24
 
24
25
  def client_connect
25
- Lita.logger.info('Authenticating with RingCentral.')
26
+ Lita.logger.info("#{@logger_prefix}Authenticating with RingCentral.")
26
27
  if @token.nil?
27
28
  @client.authorize_password @username, @extension, @password
28
29
  else
@@ -39,7 +40,7 @@ module Lita
39
40
  end
40
41
 
41
42
  def message(to_number, strings)
42
- Lita.logger.info("Sending message to #{to_number}")
43
+ Lita.logger.info("#{@logger_prefix}Sending message to #{to_number}")
43
44
  Lita.logger.info MultiJson.encode(strings)
44
45
  strings.each do |s|
45
46
  @client.messages.sms.create(
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-ringcentral'
3
3
  spec.date = '2016-09-04'
4
- spec.version = '0.0.2'
4
+ spec.version = '0.0.3'
5
5
  spec.authors = ['John Wang']
6
6
  spec.email = ["johncwang@gmail.com"]
7
7
  spec.description = %q{A RingCentral SMS adapter for Lita.}
@@ -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.3.2'
19
+ spec.add_runtime_dependency 'ringcentral_sdk', '>= 1.3.4'
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'pry-byebug'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-ringcentral
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wang
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.2
33
+ version: 1.3.4
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.3.2
40
+ version: 1.3.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement