factor-connector-slack 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/factor/connector/slack.rb +37 -0
  3. metadata +114 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Zjc5ZGNmYjU2OGU3MTYwODE1ZDY2ZmVhZDI5ZDEyODMxNmE3MDIxNw==
5
+ data.tar.gz: !binary |-
6
+ N2YzNWQ1M2VlMzgzZDkzZGZkMzZkMjNjYmQ2MWY1YWQ3Y2RiM2M3Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ Y2Q3YjY0MDI1NzNkM2U1NDdjYzFmMzRiZDZiODc0NmU1OGQ2YmU2NjA5YTgz
10
+ NWRiZDNkODg3MWRmYjk4ZGJjMjdjN2IxODExMWIwNzE2MTA2MjUwZjVmNDAw
11
+ Nzk2NzY1ZDJjNmMyZDVjNjZlOGRmNmFhYjc4ZGViMzgzOWEzNDg=
12
+ data.tar.gz: !binary |-
13
+ Nzg5ODE4NDcxMmEzOWJmYjhmZmVjZGRmYzljYzY5MWYwMThmMzU3YjNlMDE1
14
+ N2ExM2FjOWExYWI2Y2E0Mjc2OTIyYzZlMTkzNGFmZmFlZDNmNDFiNmZiYzdm
15
+ OGFkNzg2N2Q0NjgwNTFhYjA5OWRjZDg5ODgzNWIyYWYzOTVmMjU=
@@ -0,0 +1,37 @@
1
+ require 'factor-connector-api'
2
+ require 'rest_client'
3
+
4
+ Factor::Connector.service 'slack' do
5
+ action "send" do |params|
6
+
7
+ token = params['token']
8
+ channel = params['channel']
9
+ text = params['text']
10
+
11
+
12
+ fail 'Token is required' unless token
13
+ fail 'Channel is required' unless channel
14
+ fail 'Text is required' unless text
15
+
16
+ payload = {
17
+ token: token,
18
+ channel: channel,
19
+ text: text
20
+ }
21
+
22
+ begin
23
+ url = 'https://slack.com/api/chat.postMessage'
24
+ raw_response = RestClient.post(url, payload)
25
+ response = JSON.parse(raw_response)
26
+ info "Message Sent"
27
+ rescue
28
+ fail 'Unable to deliver your message'
29
+ end
30
+
31
+
32
+ fail "Error from Slack API: #{response['error']}" unless response['ok']
33
+
34
+ action_callback response
35
+ end
36
+ end
37
+
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: factor-connector-slack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Akers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: factor-connector-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.9
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.9
27
+ - !ruby/object:Gem::Dependency
28
+ name: codeclimate-test-reporter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.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.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 10.3.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 10.3.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: wrong
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.7.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.7.1
83
+ description:
84
+ email:
85
+ - andrewrdakers@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - lib/factor/connector/slack.rb
91
+ homepage: https://factor.io
92
+ licenses: []
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.4.2
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Slack Factor.io Connector
114
+ test_files: []