lita-motionai 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +22 -0
- data/README.md +55 -0
- data/Rakefile +6 -0
- data/lib/lita-motionai.rb +7 -0
- data/lib/lita/handlers/motionai.rb +39 -0
- metadata +190 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 25ee10807747f38ed14537bdf998e00bc5293879
|
4
|
+
data.tar.gz: 294ab277502a8a057531a84ba8edb90e6bb48e4d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7ee48a71f3ce2f6c4f6649257ad361922c212742783a3cace747ff9705ae59fc7fbf3ed486201ffce5efcb2188417d5bd607f2ebd8ef2cded09bb1c4dc7bdb89
|
7
|
+
data.tar.gz: 19e47598f5258db2509d39f526ede87bf7cd57a43d4b60515fd97e319cdf275ba361e2df2df5d0ed63f997aa8d9d1f0786f2c88127a3e70596f7982107b9919f
|
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 John Wang
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Lita Motion AI Handler
|
2
|
+
|
3
|
+
[![Gem Version][gem-version-svg]][gem-version-link]
|
4
|
+
[![Dependency Status][dependency-status-svg]][dependency-status-link]
|
5
|
+
[![Codacy Badge][codacy-svg]][codacy-link]
|
6
|
+
[![Downloads][downloads-svg]][downloads-link]
|
7
|
+
[![Docs][docs-rubydoc-svg]][docs-rubydoc-link]
|
8
|
+
[![License][license-svg]][license-link]
|
9
|
+
|
10
|
+
Motion AI is a bot service that provides visiual design and hosting capabilities for conversational bots. Using this handler a Lita bot can offload conversational handling to Motion AI. The handler accomplishes this by sending all received messages to Motion AI by API and responding with the message returned by Motion AI.
|
11
|
+
|
12
|
+
## Configuration
|
13
|
+
|
14
|
+
### Direct
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
Lita.configure do |config|
|
18
|
+
|
19
|
+
# Motion AI API Info
|
20
|
+
config.handlers.motionai.api_key = 'my_api_key'
|
21
|
+
config.handlers.motionai.bot_id = 12345 # your Motion AI bot id
|
22
|
+
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
### Using LitaDotenv
|
27
|
+
|
28
|
+
[LitaDotenv](https://github.com/grokify/lita_dotenv) is a way to load in Lita config parameters from the environment, including the `.env` file. Some use cases include:
|
29
|
+
|
30
|
+
* using the `.env` file
|
31
|
+
* using Heroku environment variables
|
32
|
+
|
33
|
+
```
|
34
|
+
LITA_HANDLERS_MOTIONAI_apiKey=my_api_key
|
35
|
+
LITA_HANDLERS_MOTIONAI_botId__TYPEINT=12345
|
36
|
+
```
|
37
|
+
|
38
|
+
## Links
|
39
|
+
|
40
|
+
Motion AI
|
41
|
+
|
42
|
+
* https://motion.ai
|
43
|
+
|
44
|
+
[gem-version-svg]: https://badge.fury.io/rb/lita-motionai.svg
|
45
|
+
[gem-version-link]: http://badge.fury.io/rb/lita-motionai
|
46
|
+
[downloads-svg]: http://ruby-gem-downloads-badge.herokuapp.com/lita-motionai
|
47
|
+
[downloads-link]: https://rubygems.org/gems/lita-motionai
|
48
|
+
[dependency-status-svg]: https://gemnasium.com/grokify/lita-motionai.svg
|
49
|
+
[dependency-status-link]: https://gemnasium.com/grokify/lita-motionai
|
50
|
+
[codacy-svg]: https://api.codacy.com/project/badge/Grade/08a78318461441abaca6930dd35cd17f
|
51
|
+
[codacy-link]: https://www.codacy.com/app/grokify/lita-motionai
|
52
|
+
[docs-rubydoc-svg]: https://img.shields.io/badge/docs-rubydoc-blue.svg
|
53
|
+
[docs-rubydoc-link]: http://www.rubydoc.info/gems/lita-motionai/
|
54
|
+
[license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
|
55
|
+
[license-link]: https://github.com/grokify/motion-ai-ruby/blob/master/LICENSE.md
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'motion-ai'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module Lita
|
5
|
+
module Handlers
|
6
|
+
class Motionai < Handler
|
7
|
+
config :api_key, type: String, required: true
|
8
|
+
config :bot_id, type: Integer, required: true
|
9
|
+
|
10
|
+
route(/^\s*(.+)\s*/i, :anything, command: false, help: { 'listen' => 'Say anything and the bot will listen' })
|
11
|
+
|
12
|
+
def client
|
13
|
+
return @_client if @_client
|
14
|
+
@_client = MotionAI::Client.new config.api_key, config.bot_id
|
15
|
+
return @_client
|
16
|
+
end
|
17
|
+
|
18
|
+
def anything(response)
|
19
|
+
heard = response.match_data[1]
|
20
|
+
Lita.logger.debug("Message Heard: [#{heard}]")
|
21
|
+
|
22
|
+
res = client.message_bot msg: heard, session: response.user.id
|
23
|
+
|
24
|
+
Lita.logger.debug(MultiJson.encode(res.body))
|
25
|
+
|
26
|
+
if res.status == 200 && res.body.key?('botResponse')
|
27
|
+
response.reply res.body['botResponse']
|
28
|
+
else
|
29
|
+
if res.status != 200
|
30
|
+
Lita.logger.error("MotionAI API status #{res.status}")
|
31
|
+
elsif !res.body.key? 'botResponse'
|
32
|
+
Lita.logger.error("MotionAI API `botResponse` not found")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
Lita.register_handler(Lita::Handlers::Motionai)
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-motionai
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Wang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: motion-ai
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: multi_json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pretty_table
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: uuid
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2'
|
153
|
+
description: A Lita handler for Motion AI
|
154
|
+
email:
|
155
|
+
- johncwang@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- LICENSE.md
|
161
|
+
- README.md
|
162
|
+
- Rakefile
|
163
|
+
- lib/lita-motionai.rb
|
164
|
+
- lib/lita/handlers/motionai.rb
|
165
|
+
homepage: https://github.com/grokify/lita-motion-ai
|
166
|
+
licenses:
|
167
|
+
- MIT
|
168
|
+
metadata:
|
169
|
+
lita_plugin_type: handler
|
170
|
+
post_install_message:
|
171
|
+
rdoc_options: []
|
172
|
+
require_paths:
|
173
|
+
- lib
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
requirements: []
|
185
|
+
rubyforge_project:
|
186
|
+
rubygems_version: 2.6.8
|
187
|
+
signing_key:
|
188
|
+
specification_version: 4
|
189
|
+
summary: A Lita handler that uses Motion AI NLP engine
|
190
|
+
test_files: []
|