botbase 0.1.0
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/botbase.rb +56 -0
- data.tar.gz.sig +2 -0
- metadata +87 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d8d5bb969bb1ad4d55764659c255870754029e79
|
4
|
+
data.tar.gz: 32f268aff245173038f7c08a644fdb7e6a6211ab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e7825d80101bcfa0bf5ed14cd978f4e0723ecaf21b0d8fdfc62802c29a7fa780beea5e285f343567ef68e5a67f68facf1cd6072a94d7962871965947436d2792
|
7
|
+
data.tar.gz: 3b549a2afd0bf15740b2a28e5265662e00a861e5a58f931fe2a7600a62cd2ab7e7db8e577eacedaf751f45b6d37c55538a9c4bff4f6dc8fe4add032efccfa0ef
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/botbase.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: botbase.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'simple-config'
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
class BotBase
|
11
|
+
|
12
|
+
def initialize(config=nil)
|
13
|
+
|
14
|
+
|
15
|
+
if config then
|
16
|
+
|
17
|
+
h = SimpleConfig.new(config).to_h
|
18
|
+
|
19
|
+
# load the service modules
|
20
|
+
@modules = initialize_modules(h[:modules])
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def received(sender='user01', msg)
|
27
|
+
|
28
|
+
r = nil
|
29
|
+
msg_recognised = @modules.detect do |m|
|
30
|
+
r = m.query msg
|
31
|
+
end
|
32
|
+
|
33
|
+
return r if msg_recognised
|
34
|
+
|
35
|
+
''
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def initialize_modules(modules)
|
42
|
+
|
43
|
+
modules.inject([]) do |r, m|
|
44
|
+
|
45
|
+
name, settings = m
|
46
|
+
|
47
|
+
klass_name = 'BotBaseModule' + name.to_s
|
48
|
+
|
49
|
+
r << Kernel.const_get(klass_name).new(settings)
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
data.tar.gz.sig
ADDED
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: botbase
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE2MDcyNzE5MTcxM1oXDTE3MDcyNzE5MTcxM1owSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBALsbRjK2W7TcQnYBg/D9iycp31/xi/zAY2vd7FeX6antxPKUnA076arWoImS
|
19
|
+
XhkWVU1UbNUUrD5TSISg9K3wVE/lMSQkE8BxTzWvf4xJwb8TguhCQ0K+pelKSWh6
|
20
|
+
dzgecLarVD7KVSnh/JlR4+w1hu/6pAZ46+mnbeCjpF1hcuXmdFxBO1tyUJSoaqlS
|
21
|
+
i8xLq9MLtwSTpGPK2pmSwJE9pVdC8TjD19Jq/5QApq5WSomirkj3OEdvv90HLaoe
|
22
|
+
nhvYBleousRH8ydwvuEn2b/uIokILedGILKumjkFzjUP1bnkNp7o4iMAsnpjrUEG
|
23
|
+
6a33SCPWWjrX7VwKOfmfsIJQV8MCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQU2FiJHsl84wPXGGheBObeA4Vab8YwJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAAMVEiDIF
|
27
|
+
QH/f5KjMstNu7gnw2scRzUSQlonLTAGfUFX5TBAqp7gOsxMLFJnfBP7B90tyYhrW
|
28
|
+
55GRCWSAedRmHz92JIx9ViNN0KtXxnl7lRiU0QvOYRSJiVyBivBoudc8O+5rF+C4
|
29
|
+
h50lZe0SCnznLMKAS8Skdx+PNiHDqxSoOLFCGJT/ZPIVo2/edArBGdpZidUm1wRi
|
30
|
+
Xdj3LN7vmI+Eln+gl4aX5YnPQd/6xyBUOC1IRQoHczjZSaHIuJZhmSM0nRiWwKoX
|
31
|
+
geqYGl52TQMJdtPalCLoH9OSisufD1RK2ECpfXLgoL0hUX9PWk72/FKyb49bB6j5
|
32
|
+
hrQJg0Cu1Hrz3Q==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: simple-config
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.6'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.6.1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.6'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.6.1
|
56
|
+
description:
|
57
|
+
email: james@r0bertson.co.uk
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/botbase.rb
|
63
|
+
homepage: https://github.com/jrobertson/botbase
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.5.1
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Provides bot functionality primarily for use by the sps_bot gem.
|
87
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|