slack-ruby-bot 0.11.0 → 0.11.1

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
  SHA1:
3
- metadata.gz: 9478d61ec600a816259bd73d8aab8120a1d76ed2
4
- data.tar.gz: c1d005b0e9c308af61dbe3d8ec112f3a8e72b62a
3
+ metadata.gz: d0958b00b374ee4dea69c8860e5ab1599136d531
4
+ data.tar.gz: a8be598fe1fba5ef12f94fa3b5febd72d21e31e4
5
5
  SHA512:
6
- metadata.gz: ce48f28806019da9be29699e48d7aa292d70b462df75d6e5eccf0f5a7c40dde8eab1f99b3465779c55ec4c14d64c5a91f2cbbb1b370d4e570f4185701ab22720
7
- data.tar.gz: 6d13d2fe47144b8cbec5740b6598aa3b7e0f8bdf1010b27ffb41d313eb33f3d67da6e745cffc54221bdede92584a183f48decb3b5a1daeec84ecf866ec423887
6
+ metadata.gz: ee3476ee0933c59868dd5e3f1e6f6c4b0dbf8675a344d491fff3c24e593b463085da2eedbfec4ff98f78d04da97381313668e11ab72ced24168894f1efe6462e
7
+ data.tar.gz: f7a1e5ca86e43e8dd1d2ed9cfa783f72d165a8b6ffa52748f095cc0b67c74b71712fe347f2fdb7df672e28b066fe4d09330ba4c8e238c63e9305f78751be1bf9
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-03-29 16:47:34 +0200 using RuboCop version 0.51.0.
3
+ # on 2018-05-04 16:44:32 -0400 using RuboCop version 0.51.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -20,12 +20,13 @@ Lint/DuplicateMethods:
20
20
  Exclude:
21
21
  - 'lib/slack-ruby-bot/hooks/set.rb'
22
22
 
23
- # Offense count: 1
23
+ # Offense count: 2
24
24
  Lint/HandleExceptions:
25
25
  Exclude:
26
26
  - 'lib/initializers/giphy.rb'
27
+ - 'lib/initializers/giphy_client.rb'
27
28
 
28
- # Offense count: 6
29
+ # Offense count: 7
29
30
  Metrics/AbcSize:
30
31
  Max: 40
31
32
 
@@ -43,7 +44,7 @@ Metrics/ClassLength:
43
44
  Metrics/CyclomaticComplexity:
44
45
  Max: 16
45
46
 
46
- # Offense count: 249
47
+ # Offense count: 252
47
48
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
48
49
  # URISchemes: http, https
49
50
  Metrics/LineLength:
@@ -79,7 +80,7 @@ Performance/HashEachMethods:
79
80
  Exclude:
80
81
  - 'lib/slack-ruby-bot/hooks/set.rb'
81
82
 
82
- # Offense count: 32
83
+ # Offense count: 34
83
84
  Style/Documentation:
84
85
  Enabled: false
85
86
 
@@ -88,9 +89,10 @@ Style/DoubleNegation:
88
89
  Exclude:
89
90
  - 'lib/slack-ruby-bot/commands/base.rb'
90
91
 
91
- # Offense count: 1
92
+ # Offense count: 2
92
93
  # Configuration parameters: EnforcedStyle, SupportedStyles.
93
94
  # SupportedStyles: module_function, extend_self
94
95
  Style/ModuleFunction:
95
96
  Exclude:
97
+ - 'lib/initializers/giphy_client.rb'
96
98
  - 'lib/slack-ruby-bot/config.rb'
@@ -15,6 +15,10 @@ matrix:
15
15
  env: CONCURRENCY=celluloid-io WITH_GIPHY=true
16
16
  - rvm: 2.3.0
17
17
  env: CONCURRENCY=faye-websocket WITH_GIPHY=true
18
+ - rvm: 2.3.0
19
+ env: CONCURRENCY=celluloid-io WITH_GIPHY_CLIENT=true
20
+ - rvm: 2.3.0
21
+ env: CONCURRENCY=faye-websocket WITH_GIPHY_CLIENT=true
18
22
  - rvm: ruby-head
19
23
  - rvm: jruby-head
20
24
  allow_failures:
@@ -1,3 +1,8 @@
1
+ ### 0.11.1 (05/06/2018)
2
+
3
+ * [#187](https://github.com/slack-ruby/slack-ruby-bot/pull/187): Added support for the [official Giphy SDK](https://github.com/Giphy/giphy-ruby-client) - [@dblock](https://github.com/dblock).
4
+ * [#185](https://github.com/slack-ruby/slack-ruby-bot/pull/185): Log backtrace of exceptions - [@dblock](https://github.com/dblock).
5
+
1
6
  ### 0.11.0 (04/02/2018)
2
7
 
3
8
  * [#182](https://github.com/slack-ruby/slack-ruby-bot/pull/182): Refactor CommandsHelper class and Help module - [@mdudzinski](https://github.com/mdudzinski).
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gem ENV['CONCURRENCY'], require: false if ENV.key?('CONCURRENCY')
7
7
  # rubocop:enable Bundler/OrderedGems
8
8
 
9
9
  gem 'giphy', require: false if ENV.key?('WITH_GIPHY')
10
+ gem 'GiphyClient', require: false if ENV.key?('WITH_GIPHY_CLIENT')
10
11
 
11
12
  group :test do
12
13
  gem 'slack-ruby-danger', '~> 0.1.0', require: false
data/README.md CHANGED
@@ -19,8 +19,7 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
19
19
 
20
20
  ## Stable Release
21
21
 
22
- You're reading the documentation for the **next** release of slack-ruby-bot.
23
- Please see the documentation for the [last stable release, v0.10.5](https://github.com/slack-ruby/slack-ruby-bot/tree/v0.10.5) unless you're integrating with HEAD.
22
+ You're reading the documentation for the **stable** release of slack-ruby-bot, v0.11.1.
24
23
  See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
25
24
 
26
25
  ## Usage
@@ -180,7 +179,7 @@ See [examples/market](examples/market/marketbot.rb) for a working example.
180
179
 
181
180
  ### Matching text in message attachments
182
181
 
183
- You can respond to text in [attachments](https://api.slack.com/docs/message-attachments) with
182
+ You can respond to text in [attachments](https://api.slack.com/docs/message-attachments) with
184
183
  `attachment`. It will scan `text`, `pretext` and `title` fields in each attachment until a first
185
184
  match is found.
186
185
 
@@ -323,8 +322,8 @@ end
323
322
 
324
323
  ### Animated GIFs
325
324
 
326
- The `SlackRubyBot::Client` implementation comes with GIF support.
327
- To enable it simply add `gem 'giphy'` to your **Gemfile**.
325
+ The `SlackRubyBot::Client` implementation comes with GIF support. To enable it add `gem GiphyClient` (official Giphy SDK) or `gem giphy` (older SDK, deprecated) to your **Gemfile** and set a Giphy key via `ENV['GIPHY_API_KEY']`. Obtain one from [developers.giphy.com](https://developers.giphy.com).
326
+
328
327
  **Note:** Bots send animated GIFs in default commands and errors.
329
328
 
330
329
  ```ruby
@@ -338,6 +337,22 @@ class Phone < SlackRubyBot::Commands::Base
338
337
  end
339
338
  ```
340
339
 
340
+ Giphy API key is set automatically via `ENV['GIPHY_API_KEY']`. You can override this manually.
341
+
342
+ ```ruby
343
+ Giphy.configure do |config|
344
+ config.api_key = 'key'
345
+ end
346
+ ```
347
+
348
+ With `GiphyClient` you can configure the default GIF rating, which supports Y, G, PG, PG-13, and R. The default value is `G`.
349
+
350
+ ```ruby
351
+ Giphy.configure do |config|
352
+ config.rating = 'Y' # illustrated content only, i.e. cartoons
353
+ end
354
+ ```
355
+
341
356
  If you use giphy for something else but don't want your bots to send GIFs you can set `ENV['SLACK_RUBY_BOT_SEND_GIFS']` or `SlackRubyBot::Config.send_gifs` to `false`. The latter takes precedence.
342
357
 
343
358
  ```ruby
@@ -3,6 +3,6 @@ begin
3
3
  rescue LoadError
4
4
  else
5
5
  Giphy::Configuration.configure do |config|
6
- config.api_key = ENV['GIPHY_API_KEY'] || 'dc6zaTOxFJmzC' # from https://github.com/Giphy/GiphyAPI
6
+ config.api_key = ENV['GIPHY_API_KEY']
7
7
  end
8
8
  end
@@ -0,0 +1,39 @@
1
+ begin
2
+ require 'GiphyClient'
3
+
4
+ module Giphy
5
+ module Config
6
+ extend self
7
+
8
+ attr_writer :api_key
9
+ attr_writer :rating
10
+
11
+ def api_key
12
+ @api_key ||= ENV['GIPHY_API_KEY']
13
+ end
14
+
15
+ def rating
16
+ @rating ||= 'G'
17
+ end
18
+ end
19
+
20
+ class << self
21
+ def configure
22
+ block_given? ? yield(Config) : Config
23
+ end
24
+
25
+ def config
26
+ Config
27
+ end
28
+
29
+ def client
30
+ @client ||= GiphyClient::DefaultApi.new
31
+ end
32
+
33
+ def random(keywords)
34
+ client.gifs_random_get(config.api_key, tag: keywords, rating: config.rating).data
35
+ end
36
+ end
37
+ end
38
+ rescue LoadError
39
+ end
@@ -0,0 +1,69 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=giphy-api-key&tag=burrito
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.13.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json
23
+ Server:
24
+ - nginx
25
+ X-Powered-By:
26
+ - PHP/5.6.35-1+ubuntu14.04.1+deb.sury.org+1
27
+ X-Robots-Tag:
28
+ - noindex
29
+ Access-Control-Allow-Credentials:
30
+ - 'true'
31
+ Access-Control-Allow-Methods:
32
+ - GET, POST, PUT, DELETE, OPTIONS
33
+ Access-Control-Allow-Headers:
34
+ - Content-Type, Accept, x-requested-with, cache-control
35
+ Access-Control-Allow-Origin:
36
+ - "*"
37
+ X-Kong-Upstream-Latency:
38
+ - '178'
39
+ X-Kong-Proxy-Latency:
40
+ - '0'
41
+ Accept-Ranges:
42
+ - bytes
43
+ Date:
44
+ - Fri, 04 May 2018 12:16:32 GMT
45
+ X-Served-By:
46
+ - cache-den19624-DEN
47
+ X-Cache:
48
+ - MISS
49
+ - MISS from 3
50
+ X-Cache-Hits:
51
+ - '0'
52
+ X-Timer:
53
+ - S1525436192.385028,VS0,VE231
54
+ Vary:
55
+ - Accept-Encoding
56
+ Transfer-Encoding:
57
+ - chunked
58
+ Via:
59
+ - kong/0.11.0.3-enterprise-edition, 1.1 varnish, 1.1 3 (squid)
60
+ Connection:
61
+ - keep-alive
62
+ body:
63
+ encoding: ASCII-8BIT
64
+ string: '{"data":{"type":"gif","id":"xTiTndNDuNFxUW5Xoc","slug":"burrito-taco-bell-spicy-xTiTndNDuNFxUW5Xoc","url":"https:\/\/giphy.com\/gifs\/burrito-taco-bell-spicy-xTiTndNDuNFxUW5Xoc","bitly_gif_url":"https:\/\/gph.is\/1L7tIcH","bitly_url":"https:\/\/gph.is\/1L7tIcH","embed_url":"https:\/\/giphy.com\/embed\/xTiTndNDuNFxUW5Xoc","username":"","source":"https:\/\/www.youtube.com\/watch?v=o5eZS1epVYY","content_url":"","source_tld":"www.youtube.com","source_post_url":"https:\/\/www.youtube.com\/watch?v=o5eZS1epVYY","is_sticker":0,"import_datetime":"2015-05-15
65
+ 17:32:24","trending_datetime":"1970-01-01 00:00:00","images":{"fixed_height_still":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200_s.gif","width":"274","height":"200"},"original_still":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy_s.gif","width":"477","height":"348"},"fixed_width":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w.gif","width":"200","height":"146","size":"496043","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w.mp4","mp4_size":"52023","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w.webp","webp_size":"198114"},"fixed_height_small_still":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100_s.gif","width":"137","height":"100"},"fixed_height_downsampled":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200_d.gif","width":"274","height":"200","size":"201979","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200_d.webp","webp_size":"72220"},"preview":{"width":"150","height":"108","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-preview.mp4","mp4_size":"38609"},"fixed_height_small":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100.gif","width":"137","height":"100","size":"274381","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100.mp4","mp4_size":"31076","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100.webp","webp_size":"121778"},"downsized_still":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-downsized_s.gif","width":"477","height":"348","size":"81110"},"downsized":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-downsized.gif","width":"477","height":"348","size":"1890849"},"downsized_large":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.gif","width":"477","height":"348","size":"1890849"},"fixed_width_small_still":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100w_s.gif","width":"100","height":"73"},"preview_webp":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-preview.webp","width":"155","height":"113","size":"48796"},"fixed_width_still":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w_s.gif","width":"200","height":"146"},"fixed_width_small":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100w.gif","width":"100","height":"73","size":"161406","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100w.mp4","mp4_size":"21768","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100w.webp","webp_size":"78562"},"downsized_small":{"width":"426","height":"312","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-downsized-small.mp4","mp4_size":"163378"},"fixed_width_downsampled":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w_d.gif","width":"200","height":"146","size":"118889","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w_d.webp","webp_size":"46382"},"downsized_medium":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.gif","width":"477","height":"348","size":"1890849"},"original":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.gif","width":"477","height":"348","size":"1890849","frames":"26","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.mp4","mp4_size":"163985","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.webp","webp_size":"580074"},"fixed_height":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200.gif","width":"274","height":"200","size":"831881","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200.mp4","mp4_size":"75652","webp":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200.webp","webp_size":"308056"},"looping":{"mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-loop.mp4","mp4_size":"3398106"},"original_mp4":{"width":"480","height":"350","mp4":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.mp4","mp4_size":"163985"},"preview_gif":{"url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy-preview.gif","width":"97","height":"71","size":"47979"},"480w_still":{"url":"https:\/\/media0.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/480w_s.jpg","width":"480","height":"350"}},"title":"taco
66
+ bell burrito GIF","image_original_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.gif","image_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.gif","image_mp4_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/giphy.mp4","image_frames":"26","image_width":"477","image_height":"348","fixed_height_downsampled_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200_d.gif","fixed_height_downsampled_width":"274","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"146","fixed_height_small_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100.gif","fixed_height_small_still_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100_s.gif","fixed_height_small_width":"137","fixed_height_small_height":"100","fixed_width_small_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100w.gif","fixed_width_small_still_url":"https:\/\/media3.giphy.com\/media\/xTiTndNDuNFxUW5Xoc\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"73","caption":""},"meta":{"status":200,"msg":"OK","response_id":"5aec4f204d68436e6bd7e384"}}'
67
+ http_version:
68
+ recorded_at: Fri, 04 May 2018 12:16:33 GMT
69
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,71 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=giphy-api-key&rating=G&tag=burrito
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Swagger-Codegen/1.0.0/ruby
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ Expect:
17
+ - ''
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Server:
26
+ - nginx
27
+ X-Powered-By:
28
+ - PHP/5.6.35-1+ubuntu14.04.1+deb.sury.org+1
29
+ X-Robots-Tag:
30
+ - noindex
31
+ Access-Control-Allow-Credentials:
32
+ - 'true'
33
+ Access-Control-Allow-Methods:
34
+ - GET, POST, PUT, DELETE, OPTIONS
35
+ Access-Control-Allow-Headers:
36
+ - Content-Type, Accept, x-requested-with, cache-control
37
+ Access-Control-Allow-Origin:
38
+ - "*"
39
+ X-Kong-Upstream-Latency:
40
+ - '124'
41
+ X-Kong-Proxy-Latency:
42
+ - '0'
43
+ Accept-Ranges:
44
+ - bytes
45
+ Date:
46
+ - Fri, 04 May 2018 12:13:24 GMT
47
+ X-Served-By:
48
+ - cache-mdw17369-MDW
49
+ X-Cache:
50
+ - MISS
51
+ - MISS from 3
52
+ X-Cache-Hits:
53
+ - '0'
54
+ X-Timer:
55
+ - S1525436004.038252,VS0,VE209
56
+ Vary:
57
+ - Accept-Encoding
58
+ Transfer-Encoding:
59
+ - chunked
60
+ Via:
61
+ - kong/0.11.0.3-enterprise-edition, 1.1 varnish, 1.1 3 (squid)
62
+ Connection:
63
+ - keep-alive
64
+ body:
65
+ encoding: UTF-8
66
+ string: '{"data":{"type":"gif","id":"ImpBgQl7zzrO0","slug":"ImpBgQl7zzrO0","url":"https:\/\/giphy.com\/gifs\/ImpBgQl7zzrO0","bitly_gif_url":"https:\/\/gph.is\/28OFlbE","bitly_url":"https:\/\/gph.is\/28OFlbE","embed_url":"https:\/\/giphy.com\/embed\/ImpBgQl7zzrO0","username":"","source":"https:\/\/imgur.com\/gallery\/tYeJgmR","content_url":"","source_tld":"imgur.com","source_post_url":"https:\/\/imgur.com\/gallery\/tYeJgmR","is_sticker":0,"import_datetime":"2016-06-22
67
+ 21:59:33","trending_datetime":"1970-01-01 00:00:00","images":{"fixed_height_still":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200_s.gif","width":"361","height":"200"},"original_still":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy_s.gif","width":"460","height":"255"},"fixed_width":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w.gif","width":"200","height":"111","size":"286865","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w.mp4","mp4_size":"23159","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w.webp","webp_size":"116704"},"fixed_height_small_still":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100_s.gif","width":"180","height":"100"},"fixed_height_downsampled":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200_d.gif","width":"361","height":"200","size":"247115","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200_d.webp","webp_size":"84834"},"preview":{"width":"286","height":"156","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-preview.mp4","mp4_size":"47310"},"fixed_height_small":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100.gif","width":"180","height":"100","size":"238718","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100.mp4","mp4_size":"19988","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100.webp","webp_size":"100746"},"downsized_still":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-downsized_s.gif","width":"460","height":"255","size":"60015"},"downsized":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-downsized.gif","width":"460","height":"255","size":"1325100"},"downsized_large":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.gif","width":"460","height":"255","size":"1325100"},"fixed_width_small_still":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100w_s.gif","width":"100","height":"55"},"preview_webp":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-preview.webp","width":"193","height":"107","size":"48970"},"fixed_width_still":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w_s.gif","width":"200","height":"111"},"fixed_width_small":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100w.gif","width":"100","height":"55","size":"79677","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100w.mp4","mp4_size":"9285","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100w.webp","webp_size":"41476"},"downsized_small":{"width":"460","height":"254","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-downsized-small.mp4","mp4_size":"129300"},"fixed_width_downsampled":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w_d.gif","width":"200","height":"111","size":"81308","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w_d.webp","webp_size":"31548"},"downsized_medium":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.gif","width":"460","height":"255","size":"1325100"},"original":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.gif","width":"460","height":"255","size":"1325100","frames":"22","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.mp4","mp4_size":"113680","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.webp","webp_size":"538952"},"fixed_height":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200.gif","width":"361","height":"200","size":"893669","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200.mp4","mp4_size":"59270","webp":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200.webp","webp_size":"315936"},"looping":{"mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-loop.mp4","mp4_size":"1027642"},"original_mp4":{"width":"480","height":"266","mp4":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.mp4","mp4_size":"113680"},"preview_gif":{"url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy-preview.gif","width":"119","height":"66","size":"49996"},"480w_still":{"url":"https:\/\/media0.giphy.com\/media\/ImpBgQl7zzrO0\/480w_s.jpg","width":"480","height":"266"}},"title":"feel
68
+ dollar GIF","image_original_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.gif","image_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.gif","image_mp4_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/giphy.mp4","image_frames":"22","image_width":"460","image_height":"255","fixed_height_downsampled_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200_d.gif","fixed_height_downsampled_width":"361","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"111","fixed_height_small_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100.gif","fixed_height_small_still_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100_s.gif","fixed_height_small_width":"180","fixed_height_small_height":"100","fixed_width_small_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100w.gif","fixed_width_small_still_url":"https:\/\/media2.giphy.com\/media\/ImpBgQl7zzrO0\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"55","caption":""},"meta":{"status":200,"msg":"OK","response_id":"5aec4e6466454764320d1ea2"}}'
69
+ http_version:
70
+ recorded_at: Fri, 04 May 2018 12:13:24 GMT
71
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,71 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=giphy-api-key&rating=Y&tag=burrito
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Swagger-Codegen/1.0.0/ruby
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ Expect:
17
+ - ''
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json
25
+ Accept-Ranges:
26
+ - bytes
27
+ - bytes
28
+ Access-Control-Allow-Credentials:
29
+ - 'true'
30
+ Access-Control-Allow-Headers:
31
+ - Content-Type, Accept, x-requested-with, cache-control
32
+ Access-Control-Allow-Methods:
33
+ - GET, POST, PUT, DELETE, OPTIONS
34
+ Access-Control-Allow-Origin:
35
+ - "*"
36
+ Age:
37
+ - '0'
38
+ X-Robots-Tag:
39
+ - noindex
40
+ X-Kong-Upstream-Latency:
41
+ - '150'
42
+ X-Kong-Proxy-Latency:
43
+ - '0'
44
+ Content-Length:
45
+ - '6419'
46
+ Date:
47
+ - Fri, 04 May 2018 12:22:29 GMT
48
+ X-Served-By:
49
+ - cache-den19627-DEN
50
+ X-Cache:
51
+ - MISS
52
+ - MISS from 3
53
+ X-Cache-Hits:
54
+ - '0'
55
+ X-Timer:
56
+ - S1525436549.420736,VS0,VE202
57
+ Vary:
58
+ - Accept-Encoding, Accept-Encoding
59
+ Via:
60
+ - kong/0.11.0.3-enterprise-edition, 1.1 varnish, 1.1 3 (squid)
61
+ Connection:
62
+ - keep-alive
63
+ body:
64
+ encoding: UTF-8
65
+ string: '{"data":{"type":"gif","id":"hkdKLmIgB3ane","slug":"cartoonhangover-cartoon-hangover-bee-and-puppycat-deckard-hkdKLmIgB3ane","url":"https:\/\/giphy.com\/gifs\/cartoonhangover-cartoon-hangover-bee-and-puppycat-deckard-hkdKLmIgB3ane","bitly_gif_url":"http:\/\/gph.is\/1qsLT19","bitly_url":"http:\/\/gph.is\/1qsLT19","embed_url":"https:\/\/giphy.com\/embed\/hkdKLmIgB3ane","username":"beeandpuppycat","source":"http:\/\/hangover.cartoonhangover.com\/post\/101982802617\/texts-from-bae-watch-now","content_url":"","source_tld":"hangover.cartoonhangover.com","source_post_url":"http:\/\/hangover.cartoonhangover.com\/post\/101982802617\/texts-from-bae-watch-now","is_sticker":0,"import_datetime":"2014-11-07
66
+ 04:00:33","trending_datetime":"1970-01-01 00:00:00","user":{"avatar_url":"https:\/\/media.giphy.com\/avatars\/beeandpuppycat\/cyT9kR6MIqbK.gif","banner_url":"https:\/\/media.giphy.com\/headers\/beeandpuppycat\/TLNhReAxLFI9.jpg","profile_url":"https:\/\/giphy.com\/beeandpuppycat\/","username":"beeandpuppycat","display_name":"Bee
67
+ and Puppycat","twitter":"","is_verified":true},"images":{"fixed_height_still":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200_s.gif","width":"356","height":"200"},"original_still":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy_s.gif","width":"400","height":"225"},"fixed_width":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w.gif","width":"200","height":"113","size":"499059","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w.mp4","mp4_size":"159807","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w.webp","webp_size":"1023352"},"fixed_height_small_still":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100_s.gif","width":"178","height":"100"},"fixed_height_downsampled":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200_d.gif","width":"356","height":"200","size":"334553","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200_d.webp","webp_size":"140458"},"preview":{"width":"400","height":"224","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-preview.mp4","mp4_size":"44780"},"fixed_height_small":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100.gif","width":"178","height":"100","size":"892868","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100.mp4","mp4_size":"87596","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100.webp","webp_size":"544088"},"downsized_still":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-downsized_s.gif","width":"400","height":"225","size":"62328"},"downsized":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-downsized.gif","width":"400","height":"225","size":"1002923"},"downsized_large":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.gif","width":"400","height":"225","size":"1002923"},"fixed_width_small_still":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100w_s.gif","width":"100","height":"56"},"preview_webp":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-preview.webp","width":"174","height":"98","size":"48566"},"fixed_width_still":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w_s.gif","width":"200","height":"113"},"fixed_width_small":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100w.gif","width":"100","height":"56","size":"499059","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100w.mp4","mp4_size":"30578","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100w.webp","webp_size":"226546"},"downsized_small":{"width":"400","height":"224","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-downsized-small.mp4","mp4_size":"44780"},"fixed_width_downsampled":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w_d.gif","width":"200","height":"113","size":"132991","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w_d.webp","webp_size":"55952"},"downsized_medium":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.gif","width":"400","height":"225","size":"1002923"},"original":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.gif","width":"400","height":"225","size":"1002923","frames":"112","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.mp4","mp4_size":"827796","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.webp","webp_size":"1819838"},"fixed_height":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200.gif","width":"356","height":"200","size":"892868","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200.mp4","mp4_size":"322931","webp":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200.webp","webp_size":"2597356"},"looping":{"mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-loop.mp4","mp4_size":"3392324"},"original_mp4":{"width":"480","height":"270","mp4":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.mp4","mp4_size":"827796"},"preview_gif":{"url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy-preview.gif","width":"249","height":"140","size":"49584"},"480w_still":{"url":"hkdKLmIgB3ane\/480w_s.jpg","width":"480","height":"270"}},"title":"animation
68
+ cartoon hangover GIF by Bee and Puppycat","image_original_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.gif","image_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.gif","image_mp4_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/giphy.mp4","image_frames":"112","image_width":"400","image_height":"225","fixed_height_downsampled_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200_d.gif","fixed_height_downsampled_width":"356","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"113","fixed_height_small_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100.gif","fixed_height_small_still_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100_s.gif","fixed_height_small_width":"178","fixed_height_small_height":"100","fixed_width_small_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100w.gif","fixed_width_small_still_url":"https:\/\/media3.giphy.com\/media\/hkdKLmIgB3ane\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"56","caption":""},"meta":{"status":200,"msg":"OK","response_id":"5aec508574684177590570c1"}}'
69
+ http_version:
70
+ recorded_at: Fri, 04 May 2018 12:22:30 GMT
71
+ recorded_with: VCR 3.0.3
@@ -79,7 +79,8 @@ module SlackRubyBot
79
79
  logger.error e
80
80
  sleep 1 # ignore, try again
81
81
  rescue StandardError => e
82
- logger.error e
82
+ logger.error e.message
83
+ logger.error e.backtrace.join("\n")
83
84
  raise e
84
85
  ensure
85
86
  @client = nil
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBot
2
- VERSION = '0.11.0'.freeze
2
+ VERSION = '0.11.1'.freeze
3
3
  end
@@ -1,6 +1,6 @@
1
1
  describe SlackRubyBot::Client do
2
2
  describe '#send_gifs?' do
3
- context 'without giphy is false', unless: ENV.key?('WITH_GIPHY') do
3
+ context 'without giphy is false', unless: WithGiphy.env? do
4
4
  it 'by default' do
5
5
  expect(subject.send_gifs?).to be false
6
6
  end
@@ -16,7 +16,7 @@ describe SlackRubyBot::Client do
16
16
  end
17
17
  end
18
18
 
19
- context 'with giphy', if: ENV.key?('WITH_GIPHY') do
19
+ context 'with giphy', if: WithGiphy.env? do
20
20
  it 'default is true' do
21
21
  expect(subject.send_gifs?).to be true
22
22
  end
@@ -1,4 +1,4 @@
1
- describe SlackRubyBot::Commands, if: ENV.key?('WITH_GIPHY') do
1
+ describe SlackRubyBot::Commands, if: WithGiphy.env? do
2
2
  let! :command do
3
3
  Class.new(SlackRubyBot::Commands::Base) do
4
4
  command 'send_gif_spec' do |client, data, _match|
@@ -8,9 +8,9 @@ describe SlackRubyBot::Commands, if: ENV.key?('WITH_GIPHY') do
8
8
  end
9
9
 
10
10
  let(:gif_image_url) { 'http://media2.giphy.com/media/pzOijFsdDrsS4/giphy.gif' }
11
+ let(:gif) { OpenStruct.new('image_url' => gif_image_url) }
11
12
 
12
13
  it 'sends a gif' do
13
- gif = Giphy::RandomGif.new('image_url' => gif_image_url)
14
14
  expect(Giphy).to receive(:random).and_return(gif)
15
15
  expect(message: "#{SlackRubyBot.config.user} send_gif_spec message").to respond_with_slack_message(gif_image_url)
16
16
  end
@@ -1,4 +1,4 @@
1
- describe SlackRubyBot::Commands, if: ENV.key?('WITH_GIPHY') do
1
+ describe SlackRubyBot::Commands, if: WithGiphy.env? do
2
2
  let! :command do
3
3
  Class.new(SlackRubyBot::Commands::Base) do
4
4
  command 'send_message_with_gif_spec' do |client, data, match|
@@ -6,10 +6,11 @@ describe SlackRubyBot::Commands, if: ENV.key?('WITH_GIPHY') do
6
6
  end
7
7
  end
8
8
  end
9
+
9
10
  let(:gif_image_url) { 'http://media2.giphy.com/media/pzOijFsdDrsS4/giphy.gif' }
11
+ let(:gif) { OpenStruct.new('image_url' => gif_image_url) }
10
12
 
11
13
  it 'sends a message with gif' do
12
- gif = Giphy::RandomGif.new('image_url' => gif_image_url)
13
14
  expect(Giphy).to receive(:random).and_return(gif)
14
15
  expect(message: "#{SlackRubyBot.config.user} send_message_with_gif_spec message").to respond_with_slack_message("message\n#{gif_image_url}")
15
16
  end
@@ -2,7 +2,7 @@ describe SlackRubyBot::Config do
2
2
  describe '.send_gifs?' do
3
3
  after { ENV.delete 'SLACK_RUBY_BOT_SEND_GIFS' }
4
4
 
5
- context 'without giphy is false', unless: ENV.key?('WITH_GIPHY') do
5
+ context 'without giphy is false', unless: WithGiphy.env? do
6
6
  it 'by default' do
7
7
  expect(SlackRubyBot::Config.send_gifs?).to be false
8
8
  end
@@ -15,7 +15,7 @@ describe SlackRubyBot::Config do
15
15
  expect(SlackRubyBot::Config.send_gifs?).to be false
16
16
  end
17
17
  end
18
- context 'with giphy', if: ENV.key?('WITH_GIPHY') do
18
+ context 'with giphy', if: WithGiphy.env? do
19
19
  it 'default is true' do
20
20
  expect(SlackRubyBot::Config.send_gifs?).to be true
21
21
  end
@@ -0,0 +1,28 @@
1
+ if ENV.key?('WITH_GIPHY_CLIENT')
2
+ describe Giphy do
3
+ before do
4
+ ENV['GIPHY_API_KEY'] = 'giphy-api-key'
5
+ end
6
+ after do
7
+ ENV.delete('GIPHY_API_KEY')
8
+ end
9
+ context 'rated g' do
10
+ let(:burrito_gif) { 'https://media2.giphy.com/media/ImpBgQl7zzrO0/giphy.gif' }
11
+ it 'random', vcr: { cassette_name: 'giphy_client_burrito' } do
12
+ expect(Giphy.random('burrito').image_url).to eq burrito_gif
13
+ end
14
+ end
15
+ context 'rated y' do
16
+ before do
17
+ Giphy.config.rating = 'Y'
18
+ end
19
+ after do
20
+ Giphy.config.rating = 'G'
21
+ end
22
+ let(:burrito_gif) { 'https://media3.giphy.com/media/hkdKLmIgB3ane/giphy.gif' }
23
+ it 'random', vcr: { cassette_name: 'giphy_client_burrito_rated_y' } do
24
+ expect(Giphy.random('burrito').image_url).to eq burrito_gif
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ if ENV.key?('WITH_GIPHY')
2
+ describe Giphy do
3
+ let(:burrito_gif) { 'https://media3.giphy.com/media/xTiTndNDuNFxUW5Xoc/giphy.gif' }
4
+ before do
5
+ Giphy::Configuration.configure do |config|
6
+ config.api_key = 'giphy-api-key'
7
+ end
8
+ end
9
+ after do
10
+ Giphy::Configuration.configure do |config|
11
+ config.api_key = ENV['GIPHY_API_KEY']
12
+ end
13
+ end
14
+ it 'random', vcr: { cassette_name: 'giphy_burrito' } do
15
+ expect(Giphy.random('burrito').image_url.to_s).to eq burrito_gif
16
+ end
17
+ end
18
+ end
@@ -13,12 +13,12 @@ describe SlackRubyBot::Server do
13
13
  expect(server.send(:client).token).to eq 'token'
14
14
  end
15
15
 
16
- it 'send_gifs is false without giphy', unless: ENV.key?('WITH_GIPHY') do
16
+ it 'send_gifs is false without giphy', unless: WithGiphy.env? do
17
17
  server = SlackRubyBot::Server.new(send_gifs: true)
18
18
  expect(server.send(:client).send_gifs?).to be false
19
19
  end
20
20
 
21
- it 'send_gifs', if: ENV.key?('WITH_GIPHY') do
21
+ it 'send_gifs', if: WithGiphy.env? do
22
22
  server = SlackRubyBot::Server.new(send_gifs: true)
23
23
  expect(server.send(:client).send_gifs?).to be true
24
24
  server = SlackRubyBot::Server.new(send_gifs: false)
@@ -59,7 +59,7 @@ describe SlackRubyBot::Server do
59
59
  allow(subject).to receive(:sleep)
60
60
  allow(SlackRubyBot::Server).to receive(:auth!)
61
61
  expect(Slack::RealTime::Client).to receive(:new).twice.and_return(client)
62
- expect(logger).to receive(:error).twice
62
+ allow(logger).to receive(:error)
63
63
  end
64
64
  it 'migration_in_progress', vcr: { cassette_name: 'migration_in_progress' } do
65
65
  expect do
@@ -1,2 +1,8 @@
1
1
  require 'slack-ruby-bot/rspec'
2
2
  require 'webmock/rspec'
3
+
4
+ module WithGiphy
5
+ def self.env?
6
+ ENV.key?('WITH_GIPHY') || ENV.key?('WITH_GIPHY_CLIENT')
7
+ end
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-02 00:00:00.000000000 Z
11
+ date: 2018-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -160,6 +160,7 @@ files:
160
160
  - lib/config/boot.rb
161
161
  - lib/config/environment.rb
162
162
  - lib/initializers/giphy.rb
163
+ - lib/initializers/giphy_client.rb
163
164
  - lib/slack-ruby-bot.rb
164
165
  - lib/slack-ruby-bot/about.rb
165
166
  - lib/slack-ruby-bot/app.rb
@@ -187,6 +188,9 @@ files:
187
188
  - lib/slack-ruby-bot/mvc/view/base.rb
188
189
  - lib/slack-ruby-bot/rspec.rb
189
190
  - lib/slack-ruby-bot/rspec/support/bots_for_tests.rb
191
+ - lib/slack-ruby-bot/rspec/support/fixtures/slack/giphy_burrito.yml
192
+ - lib/slack-ruby-bot/rspec/support/fixtures/slack/giphy_client_burrito.yml
193
+ - lib/slack-ruby-bot/rspec/support/fixtures/slack/giphy_client_burrito_rated_y.yml
190
194
  - lib/slack-ruby-bot/rspec/support/fixtures/slack/migration_in_progress.yml
191
195
  - lib/slack-ruby-bot/rspec/support/slack-ruby-bot/it_behaves_like_a_slack_bot.rb
192
196
  - lib/slack-ruby-bot/rspec/support/slack-ruby-bot/not_respond.rb
@@ -248,6 +252,8 @@ files:
248
252
  - spec/slack-ruby-bot/hooks/hook_support_spec.rb
249
253
  - spec/slack-ruby-bot/hooks/message_spec.rb
250
254
  - spec/slack-ruby-bot/hooks/set_spec.rb
255
+ - spec/slack-ruby-bot/initializers/giphy_client_spec.rb
256
+ - spec/slack-ruby-bot/initializers/giphy_spec.rb
251
257
  - spec/slack-ruby-bot/mvc/controller/controller_to_command_spec.rb
252
258
  - spec/slack-ruby-bot/rspec/respond_with_error_spec.rb
253
259
  - spec/slack-ruby-bot/rspec/respond_with_slack_message_spec.rb
@@ -276,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
282
  version: 1.3.6
277
283
  requirements: []
278
284
  rubyforge_project:
279
- rubygems_version: 2.4.5.3
285
+ rubygems_version: 2.6.12
280
286
  signing_key:
281
287
  specification_version: 4
282
288
  summary: The easiest way to write a Slack bot in Ruby.
@@ -319,6 +325,8 @@ test_files:
319
325
  - spec/slack-ruby-bot/hooks/hook_support_spec.rb
320
326
  - spec/slack-ruby-bot/hooks/message_spec.rb
321
327
  - spec/slack-ruby-bot/hooks/set_spec.rb
328
+ - spec/slack-ruby-bot/initializers/giphy_client_spec.rb
329
+ - spec/slack-ruby-bot/initializers/giphy_spec.rb
322
330
  - spec/slack-ruby-bot/mvc/controller/controller_to_command_spec.rb
323
331
  - spec/slack-ruby-bot/rspec/respond_with_error_spec.rb
324
332
  - spec/slack-ruby-bot/rspec/respond_with_slack_message_spec.rb