slackdraft 0.7.6c
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rock.yml +2 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +22 -0
- data/README.md +2 -0
- data/Rakefile +1 -0
- data/bin/slackdraft +13 -0
- data/lib/slackdraft/version.rb +3 -0
- data/lib/slackdraft.rb +83 -0
- data/slackdraft.gemspec +33 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5e50ebf5183cb3d283edc5f715557586975a11b6
|
4
|
+
data.tar.gz: ff7919f5e9d145855528f2a86c0c039611deabbb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f87c2bf0b4f5d15be3f3ebfe550e1112a20eef70d18dda20a1f56d9bc280aa03bf003abd939a547adf4b7d59d46da3011ddbae0f15eb9b19ac6adf635e4ce489
|
7
|
+
data.tar.gz: 25bbb8556fe4b30fe21cfe6569532f45df7724aeaa8954fb340990f2b0bdf5f56e691da00e2ff18c3e4a1f61827f5e0b39f231edbf6f747d07015a2793cf7886
|
data/.gitignore
ADDED
data/.rock.yml
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
slackdraft (0.7.6c)
|
5
|
+
httparty
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.3.7)
|
11
|
+
crack (0.4.2)
|
12
|
+
safe_yaml (~> 1.0.0)
|
13
|
+
diff-lcs (1.2.5)
|
14
|
+
httparty (0.13.3)
|
15
|
+
json (~> 1.8)
|
16
|
+
multi_xml (>= 0.5.2)
|
17
|
+
json (1.8.2)
|
18
|
+
multi_xml (0.5.5)
|
19
|
+
rake (10.4.2)
|
20
|
+
rspec (3.2.0)
|
21
|
+
rspec-core (~> 3.2.0)
|
22
|
+
rspec-expectations (~> 3.2.0)
|
23
|
+
rspec-mocks (~> 3.2.0)
|
24
|
+
rspec-core (3.2.0)
|
25
|
+
rspec-support (~> 3.2.0)
|
26
|
+
rspec-expectations (3.2.0)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.2.0)
|
29
|
+
rspec-mocks (3.2.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.2.0)
|
32
|
+
rspec-support (3.2.1)
|
33
|
+
safe_yaml (1.0.4)
|
34
|
+
webmock (1.20.4)
|
35
|
+
addressable (>= 2.3.6)
|
36
|
+
crack (>= 0.3.2)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
bundler
|
43
|
+
rake
|
44
|
+
rspec
|
45
|
+
slackdraft!
|
46
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Mike Mackintosh
|
2
|
+
|
3
|
+
MIT License
|
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
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/slackdraft
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require 'slackdraft'
|
5
|
+
|
6
|
+
slack = Slackdraft::Message.new 'https://hooks.slack.com/services/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'
|
7
|
+
#slack.icon = "this"
|
8
|
+
#slack.icon_emoji = ":fire:"
|
9
|
+
slack.channel = "#slackdraft"
|
10
|
+
slack.text = ["Testing *formatting* and", "> this should be"]
|
11
|
+
slack.send!
|
12
|
+
|
13
|
+
puts slack.inspect
|
data/lib/slackdraft.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
require 'cgi'
|
4
|
+
|
5
|
+
require 'slackdraft/version'
|
6
|
+
#require 'slackdraft/attachment'
|
7
|
+
#require 'slackdraft/message'
|
8
|
+
|
9
|
+
module Slackdraft
|
10
|
+
class Message
|
11
|
+
|
12
|
+
# Attributes
|
13
|
+
attr_writer :username
|
14
|
+
attr_writer :channel
|
15
|
+
attr_writer :icon_url
|
16
|
+
attr_writer :icon_emoji
|
17
|
+
attr_writer :text
|
18
|
+
|
19
|
+
# Init the class
|
20
|
+
def initialize(url)
|
21
|
+
@webhookuri = url
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set the api call username
|
25
|
+
def username
|
26
|
+
@username ||= 'slackdraft'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Set the destination channel
|
30
|
+
def channel
|
31
|
+
@channel || '#general'
|
32
|
+
end
|
33
|
+
|
34
|
+
# Set the icon URL and default to the emoji
|
35
|
+
def icon_url
|
36
|
+
@icon_url || icon_emoji
|
37
|
+
end
|
38
|
+
|
39
|
+
# Set the emoji
|
40
|
+
def icon_emoji
|
41
|
+
@icon_emoji || ':fire:'
|
42
|
+
end
|
43
|
+
|
44
|
+
# Set the text of the message
|
45
|
+
def text
|
46
|
+
@text.join("\n")
|
47
|
+
puts @text
|
48
|
+
end
|
49
|
+
|
50
|
+
# Send the message!
|
51
|
+
def send!
|
52
|
+
|
53
|
+
puts @channel
|
54
|
+
puts @username
|
55
|
+
|
56
|
+
request = HTTParty.post(@webhookuri, :body => {
|
57
|
+
:payload => {
|
58
|
+
:channel => @channel,
|
59
|
+
:username => @username,
|
60
|
+
:text => @text,
|
61
|
+
:icon_emoji => @icon_emoji,
|
62
|
+
}.to_json
|
63
|
+
})
|
64
|
+
|
65
|
+
puts request.code
|
66
|
+
puts request.body
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
class Attachment
|
72
|
+
attr_writer :fallback
|
73
|
+
attr_writer :text
|
74
|
+
attr_writer :pretext
|
75
|
+
attr_writer :color
|
76
|
+
attr_writer :fields
|
77
|
+
|
78
|
+
def initialize
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
data/slackdraft.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Created by hand, like a real man
|
2
|
+
# coding: utf-8
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'slackdraft/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
|
9
|
+
s.name = 'slackdraft'
|
10
|
+
s.version = Slackdraft::VERSION
|
11
|
+
s.date = '2015-02-14'
|
12
|
+
s.summary = "Slack messaging with half the Kurt Russel"
|
13
|
+
s.description = "Slack messaging with half the Kurt Russel"
|
14
|
+
s.authors = ["Mike Mackintosh"]
|
15
|
+
s.email = 'm@zyp.io'
|
16
|
+
s.homepage =
|
17
|
+
'http://github.com/mikemackintosh/slackdraft'
|
18
|
+
|
19
|
+
s.license = 'MIT'
|
20
|
+
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
s.files = `git ls-files -z`.split("\x0")
|
23
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
25
|
+
|
26
|
+
s.add_dependency 'httparty'
|
27
|
+
|
28
|
+
s.add_development_dependency "bundler"
|
29
|
+
s.add_development_dependency "rake"
|
30
|
+
s.add_development_dependency "rspec"
|
31
|
+
s.add_development_dependency "webmock"
|
32
|
+
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slackdraft
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.6c
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Mackintosh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: rake
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
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
|
+
description: Slack messaging with half the Kurt Russel
|
84
|
+
email: m@zyp.io
|
85
|
+
executables:
|
86
|
+
- slackdraft
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .rock.yml
|
92
|
+
- .rspec
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- bin/slackdraft
|
99
|
+
- lib/slackdraft.rb
|
100
|
+
- lib/slackdraft/version.rb
|
101
|
+
- slackdraft.gemspec
|
102
|
+
homepage: http://github.com/mikemackintosh/slackdraft
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>'
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 1.3.1
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.0.14
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Slack messaging with half the Kurt Russel
|
126
|
+
test_files: []
|