slack_bot 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 053825e40815b1120ba20e773089ca8390b24741
4
+ data.tar.gz: af2fba9682f0d98f4f9cda58ae0601ae72b7da52
5
+ SHA512:
6
+ metadata.gz: 55057785689d5250137692e5850b821b67a4e383754f4f047aaeb6eb4f508f20fbca996de9cff27aead5048755dd4a2610596c7651135ae8d53fb24addb0b9ca
7
+ data.tar.gz: 1f5ac6012e1b69e9f80f4139575145e579539f78d6632f68a079abed084eba8351de92aa318c8a9b113b421b11fee00b62d6aeab18149fb5262b273a41182eda
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,23 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SlackBot'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
@@ -0,0 +1,19 @@
1
+ module SlackBot
2
+ class Notify < ActiveRecord::Base
3
+
4
+ def self.execute
5
+ query = {
6
+ token: ::SlackBot.token,
7
+ channel: ::SlackBot.channel,
8
+ text: ::SlackBot.body,
9
+ username: ::SlackBot.bot_name
10
+ }
11
+ uri = Addressable::URI.parse(::SlackBot.endpoint)
12
+ uri.query_values ||= {}
13
+ uri.query_values = uri.query_values.merge(query)
14
+
15
+ Net::HTTP.get(URI.parse(uri))
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,35 @@
1
+ require "slack_bot/engine"
2
+ require "addressable/uri"
3
+
4
+ module SlackBot
5
+ # your private slack token
6
+ mattr_accessor :token do
7
+ '<YOUR_SLACK_API_TOKEN>'
8
+ end
9
+
10
+ # your private slack channel
11
+ mattr_accessor :channel do
12
+ '<YOUR_SLACK_CHANNEL_OR_GROUP>'
13
+ end
14
+
15
+ # sandbox slack endpoint
16
+ mattr_accessor :endpoint do
17
+ 'https://slack.com/api/chat.postMessage'
18
+ end
19
+
20
+ mattr_accessor :body do
21
+ 'error occured at test'
22
+ end
23
+
24
+ mattr_accessor :bot_name do
25
+ 'SlackBot'
26
+ end
27
+
28
+ def self.setup
29
+ yield self if block_given?
30
+ end
31
+
32
+ def self.notify
33
+ Notify.execute
34
+ end
35
+ end
@@ -0,0 +1,4 @@
1
+ module SlackBot
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module SlackBot
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :slack_bot do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slack_bot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - kidachi_
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.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.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: addressable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.6
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.3.6
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: SlackBot.
56
+ email:
57
+ - t.daiki50@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - MIT-LICENSE
63
+ - Rakefile
64
+ - app/models/slack_bot/notify.rb
65
+ - config/routes.rb
66
+ - lib/slack_bot.rb
67
+ - lib/slack_bot/engine.rb
68
+ - lib/slack_bot/version.rb
69
+ - lib/tasks/slack_bot_tasks.rake
70
+ homepage: ''
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.2.2
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: SlackBot.
94
+ test_files: []