breacan 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: b00472d07204ce1568710fee7a51ea915968d28f
4
- data.tar.gz: 82694f601cc895ddf3810c6521e343ff9a25fea7
3
+ metadata.gz: 7d121b57628f0c1cd2f48a250ed9daf61446f6e9
4
+ data.tar.gz: ed247bb1c8a878fd5377b474dcf8d1c0aa077265
5
5
  SHA512:
6
- metadata.gz: b863a33cc7bcf774774b71e3db3af49b030834eb7b5830edca2b381e2598c186039ab741c23ba0afe17109033a0f9a8986fcbd27fb66f5e6f7e902af28967c83
7
- data.tar.gz: 7815344349e9d1890c3445bf2f94c199fb05e0c23cd0a558d66d5aedf29fc7ec5feb73ca8833eab78f44e17dfebce1670d6d3f437cb9beddc6c8cce618f47a25
6
+ metadata.gz: 20a454072636076b66d1db147f617731c104f65891d9a33b463be608de558e44e73d57ecd7836c268bbc31bb9111b957847d49e8cb398bf083d9d9497a43221e
7
+ data.tar.gz: b39ab20c049dae816f8bc1d1f2878cd25e87f89febd87d1e2038c3593b1969d0ae89289ab66511969ae27ea8abdec07d7ed0106b7a3d7a0111aae4726d728339
data/README.md CHANGED
@@ -41,6 +41,8 @@ Breacan.channels
41
41
  :is_general=>false,
42
42
  :is_member=>false,
43
43
  :members=> ["U0NLXXXX",...
44
+ Breacan.channels_info_by_name('hello').id
45
+ => "C03QXXXX"
44
46
  ```
45
47
 
46
48
  Contributing
@@ -59,8 +59,7 @@ module Breacan
59
59
  end
60
60
 
61
61
  def channels_info_by_name(name)
62
- res = channels_list
63
- res.channels.find { |ch| ch['name'] == name } if res.ok
62
+ channels_list.find { |ch| ch['name'] == name }
64
63
  end
65
64
  end
66
65
  end
@@ -35,6 +35,12 @@ module Breacan
35
35
  end
36
36
 
37
37
  def reset!
38
+ builder = if defined? Faraday::RackBuilder
39
+ Faraday::RackBuilder
40
+ else
41
+ Faraday::Builder
42
+ end
43
+
38
44
  @access_token = ENV['BREACAN_ACCESS_TOKEN']
39
45
  @team = ENV['BREACAN_TEAM']
40
46
  @api_endpoint = ENV['BREACAN_API_ENDPOINT'] || 'https://slack.com/api/'
@@ -43,10 +49,11 @@ module Breacan
43
49
  @media_type = 'application/json'
44
50
  @connection_options = { headers: { accept: media_type, user_agent: user_agent } }
45
51
  @proxy = ENV['BREACAN_PROXY']
46
- @middleware = Faraday::RackBuilder.new { |builder|
47
- builder.adapter Faraday.default_adapter
48
- builder.response :breacan_custom
49
- }
52
+ @middleware = builder.new { |c|
53
+ c.adapter Faraday.default_adapter
54
+ c.response :breacan_custom
55
+ }
56
+
50
57
  self
51
58
  end
52
59
  alias setup reset!
@@ -8,7 +8,7 @@ module Breacan
8
8
  private
9
9
 
10
10
  def on_complete(res)
11
- if error = Breacan::Error.from_response(res)
11
+ if error = Breacan::Error.from_body(res)
12
12
  raise error
13
13
  end
14
14
 
@@ -1,3 +1,3 @@
1
1
  module Breacan
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breacan
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
  - linyows
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2015-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sawyer