slack-poster 2.0.0 → 2.1.0

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: 6c7479325afff0e574ff8589b13fe01fd3229975
4
- data.tar.gz: 442f9ee35a4f8e9e35c58836ae4162145f9efc8e
3
+ metadata.gz: 84df82be11f38200d7cafbf3d7f1d3cc78e5f3e2
4
+ data.tar.gz: 7445a106bac353700f11dcc5d415302d7cefc591
5
5
  SHA512:
6
- metadata.gz: fe8ecdbecc1287a776c3288633550e646f8560ea0be0823664f041ba35f9e49e7d389babf2fb4d47193fc3cb0263e7dc7c4f7b2faa31c1fe41cf0470241b0fd8
7
- data.tar.gz: 2941acd2b4fd0dbdf07479fd449f562e4f702ef21445c681279c8463211a7c8db5cb405be2c5fff606821ac9b32081dc7416a323200734850c0a8cec195b3bec
6
+ metadata.gz: 6235e62179a81a1c45321c307141522a25527d9c69b2e50b4cb63c9d4b0d0307631e34cf4bd805326dfb261b535e8cbdcd4e30bf51d12f99f0560974efb61982
7
+ data.tar.gz: c144f70a8dd23a02c1f2b5e5534efe8603d37fae435ab69e8021c6ec2b31cf83401147ec51fcee31bbc0c8c49eeb52f5158a129e2c9ec3dc753b4b28b16a9b6d
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3.0
data/.travis.yml CHANGED
@@ -4,4 +4,8 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1.6
6
6
  - 2.2.2
7
+ - 2.3.0
7
8
  before_install: gem install bundler -v 1.10.6
9
+ script:
10
+ - bundle exec rspec --fail-fast
11
+ - bundle exec rubocop
data/Gemfile CHANGED
@@ -1,2 +1,3 @@
1
1
  source 'https://rubygems.org'
2
+
2
3
  gemspec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'bundler/setup'
4
- require 'slack_poster'
4
+
5
+ Bundler.require
5
6
 
6
7
  require 'pry'
7
8
  Pry.start
@@ -3,7 +3,7 @@ module Slack
3
3
  ATTRIBUTES = [
4
4
  :fallback, :text, :title, :title_link, :image_url, :thumb_url, :color, :pretext, :author,
5
5
  :author_name, :author_link, :author_icon
6
- ]
6
+ ].freeze
7
7
 
8
8
  ATTRIBUTES.each do |attribute|
9
9
  attr_accessor attribute
@@ -30,8 +30,8 @@ module Slack
30
30
  hash[attribute] = send(attribute) if send(attribute)
31
31
  end
32
32
 
33
- hash.merge!(fields: fields.map(&:as_json)) unless fields.empty?
34
- hash.merge!(author: author.as_json) if author
33
+ hash[:fields] = fields.map(&:as_json) unless fields.empty?
34
+ hash[:author] = author.as_json if author
35
35
 
36
36
  hash
37
37
  end
File without changes
File without changes
@@ -1,3 +1,8 @@
1
+ require 'slack/version'
2
+ require 'slack/field'
3
+ require 'slack/message'
4
+ require 'slack/attachment'
5
+
1
6
  require 'httparty'
2
7
 
3
8
  module Slack
@@ -48,7 +53,7 @@ module Slack
48
53
 
49
54
  @options = options
50
55
 
51
- fail ArgumentError, 'Webhook URL is required' if webhook_url.nil?
56
+ raise ArgumentError, 'Webhook URL is required' if webhook_url.nil?
52
57
  end
53
58
 
54
59
  # Sends a message to Slack. The message can be either plain text or a Slack::Message object.
@@ -0,0 +1,3 @@
1
+ module Slack
2
+ VERSION = '2.1.0'.freeze
3
+ end
data/slack-poster.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
- require 'slack-poster/version'
5
+ require 'slack/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'slack-poster'
9
- spec.version = Slack::VERSION
9
+ spec.version = Slack::VERSION.dup
10
10
  spec.authors = ['Ricardo Otero']
11
11
  spec.email = ['oterosantos@gmail.com']
12
12
  spec.summary = 'Slack wrapper for Incoming WebHooks integrations.'
@@ -16,16 +16,16 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0")
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.test_files = spec.files.grep(%r{^(spec)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_development_dependency 'bundler', '~> 1.10.6', '>= 1.10.6'
23
- spec.add_development_dependency 'rake', '~> 10.4.2', '>= 10.4.2'
24
- spec.add_development_dependency 'rspec', '~> 3.2.0', '>= 3.2.0'
25
- spec.add_development_dependency 'pry', '~> 0.10.3'
26
- spec.add_development_dependency 'webmock', '~> 1.22.3', '>= 1.22.3'
27
- spec.add_development_dependency 'vcr', '~> 3.0.0', '>= 3.0.0'
28
- spec.add_development_dependency 'rubocop', '~> 0.35.1'
22
+ spec.add_development_dependency 'bundler', '> 1.10.0'
23
+ spec.add_development_dependency 'rake', '~> 10.4'
24
+ spec.add_development_dependency 'rspec', '~> 3.4'
25
+ spec.add_development_dependency 'pry', '~> 0.10'
26
+ spec.add_development_dependency 'webmock', '~> 1.22'
27
+ spec.add_development_dependency 'vcr', '~> 3.0'
28
+ spec.add_development_dependency 'rubocop', '~> 0.37', '> 0.35'
29
29
 
30
- spec.add_runtime_dependency 'httparty', '~> 0.13.7'
30
+ spec.add_runtime_dependency 'httparty', '~> 0.13'
31
31
  end
data/spec/poster_spec.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
+ # Ruby 1.9.3 needs to require securerandom
4
+ require 'securerandom' if RUBY_VERSION < '2.0.0'
5
+
3
6
  describe Slack::Poster do
4
7
  let(:hook) { ENV.fetch('SLACK_POSTER_TEST_WEBHOOK') }
5
8
  let(:poster) { described_class.new(hook) }
@@ -35,7 +38,7 @@ describe Slack::Poster do
35
38
  end
36
39
  end
37
40
 
38
- describe "#{option_attr}" do
41
+ describe option_attr.to_s do
39
42
  it "gets the #{option_attr} field in options hash" do
40
43
  expect(with_options.send(option_attr)).to eq(with_options.options[option_attr])
41
44
  end
data/spec/spec_helper.rb CHANGED
@@ -1,99 +1,25 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause
4
- # this file to always be loaded, without a need to explicitly require it in any
5
- # files.
6
- #
7
- # Given that it is always loaded, you are encouraged to keep this file as
8
- # light-weight as possible. Requiring heavyweight dependencies from this file
9
- # will add to the boot time of your test suite on EVERY test run, even for an
10
- # individual file that may not need all of that loaded. Instead, consider making
11
- # a separate helper file that requires the additional dependencies and performs
12
- # the additional setup, and require it from the spec files that actually need
13
- # it.
14
- #
15
- # The `.rspec` file also contains a few flags that are not defaults but that
16
- # users commonly want.
17
- #
18
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
1
  require 'bundler/setup'
20
- Bundler.setup
21
2
 
22
- require 'slack_poster'
3
+ Bundler.require
23
4
 
24
5
  # Use the poster test webhook from an env variable
25
- ENV['SLACK_POSTER_TEST_WEBHOOK'] ||= 'https://hooks.slack.com/services/TEST'
6
+ ENV['SLACK_POSTER_TEST_WEBHOOK'] ||= 'https://hooks.slack.com/services/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'
26
7
 
8
+ require 'vcr'
27
9
  require 'webmock/rspec'
28
10
 
29
11
  WebMock.disable_net_connect!
30
12
 
31
- require 'vcr'
32
-
33
13
  VCR.configure do |config|
34
14
  config.cassette_library_dir = 'spec/cassettes'
35
15
  config.hook_into :webmock
36
16
  end
37
17
 
38
18
  RSpec.configure do |config|
39
- # rspec-expectations config goes here. You can use an alternate
40
- # assertion/expectation library such as wrong or the stdlib/minitest
41
- # assertions if you prefer.
42
- config.expect_with :rspec do |expectations|
43
- # This option will default to `true` in RSpec 4. It makes the `description`
44
- # and `failure_message` of custom matchers include text for helper methods
45
- # defined using `chain`, e.g.:
46
- # be_bigger_than(2).and_smaller_than(4).description
47
- # # => "be bigger than 2 and smaller than 4"
48
- # ...rather than:
49
- # # => "be bigger than 2"
50
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
51
- end
52
-
53
- # rspec-mocks config goes here. You can use an alternate test double
54
- # library (such as bogus or mocha) by changing the `mock_with` option here.
55
- config.mock_with :rspec do |mocks|
56
- # Prevents you from mocking or stubbing a method that does not exist on
57
- # a real object. This is generally recommended, and will default to
58
- # `true` in RSpec 4.
59
- mocks.verify_partial_doubles = true
60
- end
61
-
62
- # The settings below are suggested to provide a good initial experience
63
- # with RSpec, but feel free to customize to your heart's content.
64
-
65
- # These two settings work together to allow you to limit a spec run
66
- # to individual examples or groups you care about by tagging them with
67
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
68
- # get run.
69
- config.filter_run :focus
70
- config.run_all_when_everything_filtered = true
71
-
72
- # Limits the available syntax to the non-monkey patched syntax that is
73
- # recommended. For more details, see:
74
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
75
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
76
- # config.disable_monkey_patching!
77
-
78
19
  # This setting enables warnings. It's recommended, but in some cases may
79
20
  # be too noisy due to issues in dependencies.
80
21
  config.warnings = true
81
22
 
82
- # Many RSpec users commonly either run the entire suite or an individual
83
- # file, and it's useful to allow more verbose output when running an
84
- # individual spec file.
85
- # if config.files_to_run.one?
86
- # # Use the documentation formatter for detailed output,
87
- # # unless a formatter has already been configured
88
- # # (e.g. via a command-line flag).
89
- # config.default_formatter = 'doc'
90
- # end
91
-
92
- # Print the 10 slowest examples and example groups at the
93
- # end of the spec run, to help surface which specs are running
94
- # particularly slow.
95
- # config.profile_examples = 10
96
-
97
23
  # Run specs in random order to surface order dependencies. If you find an
98
24
  # order dependency and want to debug it, you can fix the order by providing
99
25
  # the seed, which is printed after each run.
metadata CHANGED
@@ -1,157 +1,133 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-poster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-16 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 1.10.6
20
- - - ">="
17
+ - - ">"
21
18
  - !ruby/object:Gem::Version
22
- version: 1.10.6
19
+ version: 1.10.0
23
20
  type: :development
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: 1.10.6
30
- - - ">="
24
+ - - ">"
31
25
  - !ruby/object:Gem::Version
32
- version: 1.10.6
26
+ version: 1.10.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rake
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: 10.4.2
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 10.4.2
33
+ version: '10.4'
43
34
  type: :development
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
38
  - - "~>"
48
39
  - !ruby/object:Gem::Version
49
- version: 10.4.2
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 10.4.2
40
+ version: '10.4'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: rspec
55
43
  requirement: !ruby/object:Gem::Requirement
56
44
  requirements:
57
45
  - - "~>"
58
46
  - !ruby/object:Gem::Version
59
- version: 3.2.0
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 3.2.0
47
+ version: '3.4'
63
48
  type: :development
64
49
  prerelease: false
65
50
  version_requirements: !ruby/object:Gem::Requirement
66
51
  requirements:
67
52
  - - "~>"
68
53
  - !ruby/object:Gem::Version
69
- version: 3.2.0
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 3.2.0
54
+ version: '3.4'
73
55
  - !ruby/object:Gem::Dependency
74
56
  name: pry
75
57
  requirement: !ruby/object:Gem::Requirement
76
58
  requirements:
77
59
  - - "~>"
78
60
  - !ruby/object:Gem::Version
79
- version: 0.10.3
61
+ version: '0.10'
80
62
  type: :development
81
63
  prerelease: false
82
64
  version_requirements: !ruby/object:Gem::Requirement
83
65
  requirements:
84
66
  - - "~>"
85
67
  - !ruby/object:Gem::Version
86
- version: 0.10.3
68
+ version: '0.10'
87
69
  - !ruby/object:Gem::Dependency
88
70
  name: webmock
89
71
  requirement: !ruby/object:Gem::Requirement
90
72
  requirements:
91
73
  - - "~>"
92
74
  - !ruby/object:Gem::Version
93
- version: 1.22.3
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 1.22.3
75
+ version: '1.22'
97
76
  type: :development
98
77
  prerelease: false
99
78
  version_requirements: !ruby/object:Gem::Requirement
100
79
  requirements:
101
80
  - - "~>"
102
81
  - !ruby/object:Gem::Version
103
- version: 1.22.3
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: 1.22.3
82
+ version: '1.22'
107
83
  - !ruby/object:Gem::Dependency
108
84
  name: vcr
109
85
  requirement: !ruby/object:Gem::Requirement
110
86
  requirements:
111
87
  - - "~>"
112
88
  - !ruby/object:Gem::Version
113
- version: 3.0.0
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: 3.0.0
89
+ version: '3.0'
117
90
  type: :development
118
91
  prerelease: false
119
92
  version_requirements: !ruby/object:Gem::Requirement
120
93
  requirements:
121
94
  - - "~>"
122
95
  - !ruby/object:Gem::Version
123
- version: 3.0.0
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 3.0.0
96
+ version: '3.0'
127
97
  - !ruby/object:Gem::Dependency
128
98
  name: rubocop
129
99
  requirement: !ruby/object:Gem::Requirement
130
100
  requirements:
131
101
  - - "~>"
132
102
  - !ruby/object:Gem::Version
133
- version: 0.35.1
103
+ version: '0.37'
104
+ - - ">"
105
+ - !ruby/object:Gem::Version
106
+ version: '0.35'
134
107
  type: :development
135
108
  prerelease: false
136
109
  version_requirements: !ruby/object:Gem::Requirement
137
110
  requirements:
138
111
  - - "~>"
139
112
  - !ruby/object:Gem::Version
140
- version: 0.35.1
113
+ version: '0.37'
114
+ - - ">"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.35'
141
117
  - !ruby/object:Gem::Dependency
142
118
  name: httparty
143
119
  requirement: !ruby/object:Gem::Requirement
144
120
  requirements:
145
121
  - - "~>"
146
122
  - !ruby/object:Gem::Version
147
- version: 0.13.7
123
+ version: '0.13'
148
124
  type: :runtime
149
125
  prerelease: false
150
126
  version_requirements: !ruby/object:Gem::Requirement
151
127
  requirements:
152
128
  - - "~>"
153
129
  - !ruby/object:Gem::Version
154
- version: 0.13.7
130
+ version: '0.13'
155
131
  description: Slack Poster is a gem to make your integration with Slack WebHooks easier.
156
132
  email:
157
133
  - oterosantos@gmail.com
@@ -170,12 +146,11 @@ files:
170
146
  - README.md
171
147
  - Rakefile
172
148
  - bin/console
173
- - lib/slack-poster/attachment.rb
174
- - lib/slack-poster/field.rb
175
- - lib/slack-poster/message.rb
176
- - lib/slack-poster/poster.rb
177
- - lib/slack-poster/version.rb
178
- - lib/slack_poster.rb
149
+ - lib/slack/attachment.rb
150
+ - lib/slack/field.rb
151
+ - lib/slack/message.rb
152
+ - lib/slack/poster.rb
153
+ - lib/slack/version.rb
179
154
  - slack-poster.gemspec
180
155
  - spec/attachment_spec.rb
181
156
  - spec/cassettes/default_post.yml
@@ -203,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
178
  version: '0'
204
179
  requirements: []
205
180
  rubyforge_project:
206
- rubygems_version: 2.4.5.1
181
+ rubygems_version: 2.5.1
207
182
  signing_key:
208
183
  specification_version: 4
209
184
  summary: Slack wrapper for Incoming WebHooks integrations.
@@ -1,3 +0,0 @@
1
- module Slack
2
- VERSION = '2.0.0'
3
- end
data/lib/slack_poster.rb DELETED
@@ -1,5 +0,0 @@
1
- require 'slack-poster/version'
2
- require 'slack-poster/poster'
3
- require 'slack-poster/field'
4
- require 'slack-poster/message'
5
- require 'slack-poster/attachment'