slack-poster 2.1.0 → 2.2.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: 84df82be11f38200d7cafbf3d7f1d3cc78e5f3e2
4
- data.tar.gz: 7445a106bac353700f11dcc5d415302d7cefc591
3
+ metadata.gz: 2dc84d4b5731b1487e433e2292b0f398690ea523
4
+ data.tar.gz: ddea706f2a76c965c5e100c309054789a082f379
5
5
  SHA512:
6
- metadata.gz: 6235e62179a81a1c45321c307141522a25527d9c69b2e50b4cb63c9d4b0d0307631e34cf4bd805326dfb261b535e8cbdcd4e30bf51d12f99f0560974efb61982
7
- data.tar.gz: c144f70a8dd23a02c1f2b5e5534efe8603d37fae435ab69e8021c6ec2b31cf83401147ec51fcee31bbc0c8c49eeb52f5158a129e2c9ec3dc753b4b28b16a9b6d
6
+ metadata.gz: 0feea6c7a74fef533258880438f840782487226e444fdc093cdcda5b00e27c30d149cb60d282938a31e38f7992ed31786d16ab40aa6ecd4a6c1c3a196837894e
7
+ data.tar.gz: 7974d9bfd0c3f5ebc1830e12116eb8928ce18f4caffc9ce943ed62138abc7df941ff59683cb425ec22acb498e28f3a408e8366c7b90485a0cca18d9c79c0dd89
data/lib/slack/poster.rb CHANGED
@@ -2,27 +2,13 @@ require 'slack/version'
2
2
  require 'slack/field'
3
3
  require 'slack/message'
4
4
  require 'slack/attachment'
5
-
6
- require 'httparty'
5
+ require 'json'
6
+ require 'faraday'
7
7
 
8
8
  module Slack
9
9
  class Poster
10
- include HTTParty
11
-
12
10
  attr_accessor :options
13
11
 
14
- # The format of the response. This comes back as 'ok' from slack.
15
- format :plain
16
-
17
- # Disable the use of rails query string format.
18
- #
19
- # With rails query string format enabled:
20
- # => get '/', :query => {:selected_ids => [1,2,3]}
21
- #
22
- # Would translate to this:
23
- # => /?selected_ids[]=1&selected_ids[]=2&selected_ids[]=3
24
- disable_rails_query_string_format
25
-
26
12
  # Define getters and setters for the options hash keys. This will make assign of the options
27
13
  # more flexible.
28
14
  [:username, :channel, :icon_url, :icon_emoji].each do |option_attr|
@@ -49,7 +35,7 @@ module Slack
49
35
  # username: 'Ricardo',
50
36
  # icon_emoji: 'ghost')
51
37
  def initialize(webhook_url, options = {})
52
- self.class.base_uri(webhook_url)
38
+ @base_uri = webhook_url
53
39
 
54
40
  @options = options
55
41
 
@@ -71,7 +57,9 @@ module Slack
71
57
  def send_message(message)
72
58
  body = message.is_a?(String) ? options.merge(text: message) : options.merge(message.as_json)
73
59
 
74
- response = self.class.post('', body: { payload: body.to_json })
60
+ conn = Faraday.new(url: @base_uri)
61
+
62
+ response = conn.post('', payload: body.to_json)
75
63
 
76
64
  response
77
65
  end
data/lib/slack/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
data/slack-poster.gemspec CHANGED
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'vcr', '~> 3.0'
28
28
  spec.add_development_dependency 'rubocop', '~> 0.37', '> 0.35'
29
29
 
30
- spec.add_runtime_dependency 'httparty', '~> 0.13'
30
+ spec.add_runtime_dependency 'faraday', '~> 0.9.2'
31
31
  end
data/spec/poster_spec.rb CHANGED
@@ -54,7 +54,7 @@ describe Slack::Poster do
54
54
  response = poster.send_message(message)
55
55
 
56
56
  expect(response).to_not be_nil
57
- expect(response.code).to eq(200)
57
+ expect(response.env.status).to eq(200)
58
58
  end
59
59
  end
60
60
 
@@ -63,7 +63,7 @@ describe Slack::Poster do
63
63
  response = poster.send_message('Hello world')
64
64
 
65
65
  expect(response).to_not be_nil
66
- expect(response.code).to eq(200)
66
+ expect(response.env.status).to eq(200)
67
67
  end
68
68
  end
69
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-poster
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.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: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,19 +115,19 @@ dependencies:
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0.35'
117
117
  - !ruby/object:Gem::Dependency
118
- name: httparty
118
+ name: faraday
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.13'
123
+ version: 0.9.2
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0.13'
130
+ version: 0.9.2
131
131
  description: Slack Poster is a gem to make your integration with Slack WebHooks easier.
132
132
  email:
133
133
  - oterosantos@gmail.com