skype_bot 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 +4 -4
- data/lib/skype_bot/activity.rb +14 -2
- data/lib/skype_bot/config.rb +1 -0
- data/lib/skype_bot/parser.rb +9 -12
- data/lib/skype_bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d9b5126b4cde9b2cdd812112532f7d99222389
|
4
|
+
data.tar.gz: fe10629998d37c84b413bd6c62d18ceec70fe8bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b02f3f75ca4ca16f8a60f81f2ae535d3675db7f4378c5eb735b5bc50c88d24879ebae2342636a22354d0bf9e972f5452c4b9e1a29a38c029ea82601a90b9ee9f
|
7
|
+
data.tar.gz: bbe441f731945e907798865c950de0242dd1e9887555d0b87a0cb021eec02f507b5984205af7486abba5927b689503aa07f7bedc3a020c5222b7c16385121953
|
data/lib/skype_bot/activity.rb
CHANGED
@@ -2,11 +2,11 @@ module SkypeBot
|
|
2
2
|
module Activity
|
3
3
|
extend self
|
4
4
|
|
5
|
-
CONVERSATION_URL = 'https://
|
5
|
+
CONVERSATION_URL = 'https://skype.botframework.com/v3/conversations'
|
6
6
|
|
7
7
|
def text_message(uid, content)
|
8
8
|
token = Auth.get_token
|
9
|
-
body =
|
9
|
+
body = payload(uid, content).to_json
|
10
10
|
headers = { Authorization: "Bearer #{token}", 'Content-Type': 'application/json' }
|
11
11
|
url = activity_url(uid)
|
12
12
|
|
@@ -18,5 +18,17 @@ module SkypeBot
|
|
18
18
|
def activity_url(uid)
|
19
19
|
"#{CONVERSATION_URL}/#{uid}/activities"
|
20
20
|
end
|
21
|
+
|
22
|
+
def payload(uid, content)
|
23
|
+
{
|
24
|
+
type: 'message',
|
25
|
+
agent: 'botbuilder',
|
26
|
+
source: 'skype',
|
27
|
+
text: content,
|
28
|
+
from: { id: "#{Config.skype_number}:#{Config.app_id}" },
|
29
|
+
recipient: { id: uid },
|
30
|
+
channelData: {}
|
31
|
+
}
|
32
|
+
end
|
21
33
|
end
|
22
34
|
end
|
data/lib/skype_bot/config.rb
CHANGED
data/lib/skype_bot/parser.rb
CHANGED
@@ -3,21 +3,18 @@ module SkypeBot
|
|
3
3
|
attr_accessor :payload
|
4
4
|
|
5
5
|
def initialize(data)
|
6
|
-
@payload = data['
|
6
|
+
@payload = data['skype']
|
7
7
|
end
|
8
8
|
|
9
9
|
def execute
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
content: event['content']
|
19
|
-
}
|
20
|
-
end
|
10
|
+
{
|
11
|
+
type: payload['type'].underscore,
|
12
|
+
from: payload['from']['id'],
|
13
|
+
display_name: payload['from']['name'],
|
14
|
+
to: payload['recipient']['id'],
|
15
|
+
time: Time.parse(payload['timestamp']),
|
16
|
+
content: payload['text']
|
17
|
+
}
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
data/lib/skype_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skype_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MQuy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|