slackly 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15be28ce0b3e3609ed9d263a2fe2e559a4b07a35
4
- data.tar.gz: 899521b635ab50f1209dda6d2117a8c8f8bea18d
3
+ metadata.gz: 00a82d06f7bc7afdb03667e05e6f3d710c2de78b
4
+ data.tar.gz: 73ae2a5a781d056aae46937c9886609c472dafba
5
5
  SHA512:
6
- metadata.gz: f10c0e603eb9e7c83976273218a0e04c820f1abe84e5b5b14128e31fc509f3781dc2a7763c053d0a3c16bc658b2ee850cac56742c9aed9c82ab446ac350521e9
7
- data.tar.gz: a9968c77758428f96ae67d54d80b78ddfe54db948113466fcff3e42d63148b3e6685b8055a8333e4d0c1662951fb9bbe3681a953ff650d93776cb1c79805dfdb
6
+ metadata.gz: 870e71cc662647828d49fd9f2bad2b8045b3f6aad7dda9c2eddfebf10ef6c88579a35e209d6178b870fb87657225015aeee80a19c96957effcea8cf733b3a64f
7
+ data.tar.gz: 5a703bc02c32c2b9bf54d404b9c8502c34caac81039cf9402b164e4e68578b26db37dbc4b3e325323aa62a0fce4ced524b5db319269d33eb2b1c6afa7ab5f36e
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Slackly
2
2
 
3
3
  ## Description
4
- Slackly is a simple and easy way to send messages to your Slack channels using the incoming webhooks integration.
5
- You can use it directly in your code or through the command line.
4
+ Slackly is a simple and easy way to send messages to your Slack channels using the
5
+ [incoming webhooks](https://api.slack.com/incoming-webhooks) integration. You can use it directly in your code or
6
+ through the command line.
6
7
 
7
8
  ## Installation
8
9
  ```
@@ -11,19 +12,19 @@ gem install slackly
11
12
 
12
13
  ## Usage
13
14
  In your code:
14
- ```
15
+ ```ruby
15
16
  s = Slackly.new(webhook_url)
16
17
  s.message(text: 'Hello from Slackly')
17
18
  ```
18
19
 
19
20
  Command line:
20
- ```
21
+ ```bash
21
22
  slackly message 'Hello from Slackly!'
22
23
  ```
23
24
 
24
25
  ## Configuration
25
26
  In your code:
26
- ```
27
+ ```ruby
27
28
  # these options will be the default client options and may be overriden by the message options
28
29
  client_options = {
29
30
  username: 'slackly',
@@ -40,10 +41,10 @@ s.message(message_options)
40
41
  ```
41
42
 
42
43
  The command line needs a JSON configuration file in order to configure the webhook, it defaults to './slackly.json'
43
- but you can override it with the `-c` configuration.
44
+ but you can override it with the `-c` option.
44
45
  The JSON configuration file must must have a `webhook_url` option in order for the command line to work:
45
46
 
46
- ```
47
+ ```bash
47
48
  slackly message 'Hello from Slackly!' -c path_to/config.json
48
49
  ```
49
50
 
data/lib/slackly.rb CHANGED
@@ -18,7 +18,7 @@ class Slackly
18
18
  @client_options = DEFAULT_OPTIONS.merge(client_options)
19
19
  end
20
20
 
21
- def message(message_options = {})
21
+ def message!(message_options = {})
22
22
  fail Slackly::InvalidMessageTextError, 'Please supply a valid message text' if message_options[:text].nil?
23
23
 
24
24
  request = Net::HTTP::Post.new(webhook_uri.request_uri)
@@ -26,8 +26,12 @@ class Slackly
26
26
  Net::HTTP.start(webhook_uri.host, webhook_uri.port, use_ssl: webhook_uses_ssl?) do |http|
27
27
  http.request(request)
28
28
  end
29
+ end
30
+
31
+ def message(message_options = {})
32
+ message!(message_options)
29
33
  rescue => exception
30
- STDERR.puts "Error while sending message to Slack: #{exception.message}"
34
+ warn "Error while sending message to Slack: #{exception.message}"
31
35
  end
32
36
 
33
37
  private
@@ -1,3 +1,3 @@
1
- module Slackly
2
- VERSION = '0.1.0'.freeze
1
+ class Slackly
2
+ VERSION = '0.1.1'.freeze
3
3
  end
data/slackly.gemspec CHANGED
@@ -1,3 +1,4 @@
1
+ require_relative 'lib/slackly'
1
2
  require_relative 'lib/slackly/version'
2
3
 
3
4
  Gem::Specification.new do |s|
@@ -14,9 +15,13 @@ Gem::Specification.new do |s|
14
15
  s.homepage = 'http://www.github.com/pedrocarrico/slackly'
15
16
  s.license = 'MIT'
16
17
  s.required_ruby_version = '>= 2.0'
18
+ s.require_paths = ['lib']
17
19
 
18
20
  s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.2'
19
21
 
20
22
  s.add_development_dependency 'bundler', '~> 1.8', '>= 1.8.2'
21
- s.add_development_dependency 'rubocop', '~> 0.30.1', '0.30.1'
23
+ s.add_development_dependency 'pry', '~> 0.10.1', '>= 0.10.1'
24
+ s.add_development_dependency 'rubocop', '~> 0.30.1', '>= 0.30.1'
25
+ s.add_development_dependency 'rspec', '~> 3.2.0', '>= 3.2.0'
26
+ s.add_development_dependency 'webmock', '~> 1.21.0', '>= 1.21.0'
22
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Carriço
@@ -50,6 +50,26 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.8.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: pry
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.10.1
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.10.1
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.10.1
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.10.1
53
73
  - !ruby/object:Gem::Dependency
54
74
  name: rubocop
55
75
  requirement: !ruby/object:Gem::Requirement
@@ -57,7 +77,7 @@ dependencies:
57
77
  - - "~>"
58
78
  - !ruby/object:Gem::Version
59
79
  version: 0.30.1
60
- - - '='
80
+ - - ">="
61
81
  - !ruby/object:Gem::Version
62
82
  version: 0.30.1
63
83
  type: :development
@@ -67,9 +87,49 @@ dependencies:
67
87
  - - "~>"
68
88
  - !ruby/object:Gem::Version
69
89
  version: 0.30.1
70
- - - '='
90
+ - - ">="
71
91
  - !ruby/object:Gem::Version
72
92
  version: 0.30.1
93
+ - !ruby/object:Gem::Dependency
94
+ name: rspec
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: 3.2.0
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 3.2.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 3.2.0
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.2.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: webmock
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 1.21.0
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 1.21.0
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: 1.21.0
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 1.21.0
73
133
  description: Slackly is a simple and easy way to send messages to your Slack channels
74
134
  using the incoming webhooks integration.
75
135
  email: pedro.carrico@gmail.com