slackpost 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aa7e1774c5a0b9a4542c511a0e1c17ab9324b9f12d5f0e7cd5d216c1458d9f7
4
- data.tar.gz: 7c963de9c738334066bb48e6c3ea48f7f0aadca1e85c3de9c7f740ec91e9acbb
3
+ metadata.gz: 6441d0718cb39f08857c3ecf961da28cdc52ca1cd48124d6cdc6c81c1cc20ac0
4
+ data.tar.gz: 645c6919885f3de58726871c5478c0a0c649650e02f7191d296b45fa8b93655b
5
5
  SHA512:
6
- metadata.gz: a86b8fcb64f296e897d374afe6e60b8fbecad6d0bafc0d2a22b632f13c139675f2e07562a762a21c30f3ee7b854a7ed40eab8c5b9543448c65547077e8623e07
7
- data.tar.gz: e39b6844d495b25dbdf2e987de23ae7f3c969128250a5281ffef9e2d90733f40fbfceabb1486068f7509b88c5bdc51a09ca34cde2170f0880d436d97a494c6db
6
+ metadata.gz: bde72522d222aa428ed26d1083ff70452431f9ff8b0005f1b5441a89a12edb99d629a3dd7da9d7c29abcf5127af4b8b132b8d89bda0eaa9cbbb70aeff833dfc0
7
+ data.tar.gz: 49883e69af291f12f07c70a37d81315d39bcbd69a213c7c2f1617831e4ddb69316dfde3fd7326abff533ab0554abd9bb4bcefcdcd28145022bebd6703d549c77
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.gitignore CHANGED
@@ -7,4 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /.idea
10
- /certs
10
+ /certs/*
data/README.md CHANGED
@@ -29,17 +29,23 @@ token do you need, refer to this page: https://api.slack.com/incoming-webhooks
29
29
  require 'slackpost'
30
30
 
31
31
  Slackpost.configure do |config|
32
- config.slack_token = "T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
32
+ config.slack_token = 'T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
33
33
  end
34
34
  ```
35
35
 
36
36
  That's it! And now you can use the static methods `send_message` and `send_attachemnt`, like this:
37
37
 
38
38
  ```ruby
39
- Slackpost.send_message("This is a test", 'test_channel')
39
+ Slackpost.send_message('This is a test', 'test_channel')
40
40
 
41
- Slackpost.send_attachment("This is a test attachment", 'test_channel',
42
- "attachment title", "attachment message", "#0055bb")
41
+ attachment = { fallback: 'Fallback message',
42
+ color: '#fab01a',
43
+ fields: [{ title: 'Attachment title',
44
+ value: 'Attachment text' }] }
45
+ Slackpost.send_attachment('This will send a single attachment', 'test_channel', attachment)
46
+
47
+ attachments = [attachment, attachment, attachment]
48
+ Slackpost.send_attachment('This will send multiple attachments', 'test_channel', attachments)
43
49
 
44
50
  ```
45
51
 
@@ -52,9 +58,14 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
52
58
 
53
59
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
54
60
 
61
+
55
62
  ## Contributing
56
63
 
57
- Bug reports and pull requests are welcome on GitHub at https://github.com/guillermijas/slackpost.
64
+ 1. Fork it ( https://github.com/guillermijas/slackpost/fork )
65
+ 2. Create your feature branch (`git checkout -b features/new_feature`)
66
+ 3. Commit your changes (`git commit -am 'Descriptive comment about the feature'`)
67
+ 4. Push to the branch (`git push origin features/new_feature`)
68
+ 5. Create new Pull Request
58
69
 
59
70
  ## License
60
71
 
data/lib/slackpost.rb CHANGED
@@ -25,14 +25,11 @@ module Slackpost
25
25
  send_slack(body)
26
26
  end
27
27
 
28
- def send_attachment(msg, channel, att_title, att_value, att_color)
28
+ def send_attachment(msg, channel, attachments)
29
29
  body = { channel: channel,
30
30
  link_names: 1,
31
31
  text: msg,
32
- attachments: [{ fallback: "#{att_title} #{att_value}",
33
- color: att_color,
34
- fields: [{ title: att_title,
35
- value: att_value }] }] }
32
+ attachments: [attachments].flatten }
36
33
  send_slack(body)
37
34
  end
38
35
 
@@ -1,3 +1,8 @@
1
1
  module Slackpost
2
- class SlackpostError < StandardError; end
2
+ # Errors that are thrown when the message cannot be delivered.
3
+ class SlackpostError < StandardError
4
+ def initialize(msg = 'Message could not be delivered.')
5
+ super
6
+ end
7
+ end
3
8
  end
@@ -1,3 +1,3 @@
1
1
  module Slackpost
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackpost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillermo Mora
@@ -94,11 +94,11 @@ files:
94
94
  - Rakefile
95
95
  - bin/console
96
96
  - bin/setup
97
- - certs/slackpost-cert.pem
98
97
  - lib/slackpost.rb
99
98
  - lib/slackpost/configuration.rb
100
99
  - lib/slackpost/exceptions.rb
101
100
  - lib/slackpost/version.rb
101
+ - slackpost-0.1.2.gem
102
102
  - slackpost.gemspec
103
103
  homepage: https://github.com/guillermijas/slackpost
104
104
  licenses:
metadata.gz.sig CHANGED
Binary file