lita-glip 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/lita/adapters/glip/connector.rb +1 -0
- data/lib/lita/adapters/glip/message_handler.rb +15 -4
- data/lita-glip.gemspec +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24cf9ba2a53b998c09309a760784a879df6a31bb
|
4
|
+
data.tar.gz: e57d9f01b71ec6ed7b3f6ca7df6f6eb316110f27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac47c33a7ee493a2b9a77416bc7da465eac3c324b2f4ec86c0a9f70506ed1d152bf0a391453ca270250d9f16eca23b7c7ec1f48b22287464961cd61f65f39b33
|
7
|
+
data.tar.gz: 1217eb97ffe1ebee95e65057f135e2117a68892947949aaf59a29e6e88fec184bff606e253afbe9c22660bb85eebc45de2e53c5762f7647ca4a7676375831c1b
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,9 @@ module Lita
|
|
4
4
|
module Adapters
|
5
5
|
class Glip < Adapter
|
6
6
|
class MessageHandler
|
7
|
+
TYPE_PROPERTY_A = 'eventType'
|
8
|
+
TYPE_PROPERTY_B = 'messageType'
|
9
|
+
|
7
10
|
attr_reader :robot
|
8
11
|
|
9
12
|
def initialize(robot, glip_sdk)
|
@@ -21,18 +24,26 @@ module Lita
|
|
21
24
|
return
|
22
25
|
end
|
23
26
|
|
24
|
-
unless m.key?('body')
|
27
|
+
unless m.key?('body')
|
28
|
+
Lita.logger.warn("#{@logger_prefix}Glip Lita: Glip Message Received without body: #{MultiJson.encode(m)}")
|
25
29
|
return
|
26
30
|
end
|
27
31
|
|
28
|
-
|
32
|
+
unless (m['body'].key?(TYPE_PROPERTY_A) && m['body'][TYPE_PROPERTY_A] == "PostAdded") ||
|
33
|
+
(m['body'].key?(TYPE_PROPERTY_B) && m['body'][TYPE_PROPERTY_B] == "PostAdded")
|
34
|
+
return
|
35
|
+
end
|
36
|
+
|
37
|
+
post = m['body'].key?('post') ? m['body']['post'] : m['body']
|
38
|
+
|
39
|
+
user_id = post['creatorId']
|
29
40
|
user = UserCreator.find_or_create_user user_id, @glip_sdk
|
30
41
|
|
31
|
-
room_id =
|
42
|
+
room_id = post['groupId']
|
32
43
|
room = RoomCreator.find_or_create_room room_id, @glip_sdk
|
33
44
|
|
34
45
|
source = Lita::Source.new user: user, room: room
|
35
|
-
post =
|
46
|
+
post = post['text'].to_s
|
36
47
|
msg = Lita::Message.new @robot, post, source
|
37
48
|
|
38
49
|
Lita.logger.debug("#{@logger_prefix}Glip Lita: Robot Message Built")
|
data/lita-glip.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-glip'
|
3
|
-
spec.date = '2017-
|
4
|
-
spec.version = '0.0
|
3
|
+
spec.date = '2017-04-01'
|
4
|
+
spec.version = '0.1.0'
|
5
5
|
spec.authors = ['John Wang']
|
6
6
|
spec.email = ["johncwang@gmail.com"]
|
7
7
|
spec.description = %q{A Glip adapter for Lita.}
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
19
|
spec.add_runtime_dependency 'lita', '~> 4', '>= 4.4.3'
|
20
|
-
spec.add_runtime_dependency 'glip_sdk', '~> 0', '>= 0.0.
|
20
|
+
spec.add_runtime_dependency 'glip_sdk', '~> 0', '>= 0.0.5'
|
21
21
|
spec.add_runtime_dependency 'multi_json', '~> 1', '>= 1.12.1'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-glip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '0'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.0.
|
42
|
+
version: 0.0.5
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '0'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.0.
|
52
|
+
version: 0.0.5
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: multi_json
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|