edi 0.4.7 → 0.4.8

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: 59a95b3f9c6a512fb11163af72d6e9133715fe45
4
- data.tar.gz: e2f4f8354b1f8a87c8b853fe1d02d9777ac5e884
3
+ metadata.gz: 14594d357a8cce0d8b55b18983ff51caa8971513
4
+ data.tar.gz: 3a5dd42a492702fce0026af80cdfa90e65dad685
5
5
  SHA512:
6
- metadata.gz: 81001f46bb8fb26eaca65422cae4208d1905113561d4fccc3d6287c3b3b4170c94bc52833102a0daffc953f64376e2441a3b4a1a81254d229909a3dc57452356
7
- data.tar.gz: 90fe92e23028e37d4104e116fe5f98ad511f2371bd9cfa07ea30cfb1d4f3e1225ba920d2917b2879ddd2bea44050cc10319af053fadb29717bca840a6f06da2b
6
+ metadata.gz: 080cd2875898f2cde135129af8b0af17b75d823c363fd7563f2e1967ae860715178c7716364aef279aa6a0c8279a04b2254f0488566620856d8d31adaae3cc67
7
+ data.tar.gz: 31c265826ac9da4c6b6566ae93a365014c6af3a33370373b7e965f9651f38b7b7d31266752ca7064cc2344ba8b9b71020e4a6914536ffde6fbde5db3d2722343
data/lib/edi.rb CHANGED
@@ -82,11 +82,6 @@ module EDI
82
82
  def send_message(message, channel_name: "general", channel_id: nil)
83
83
  EDI.websocket.send_message(message, channel_name: channel_name, channel_id: channel_id)
84
84
  end
85
-
86
- def logger
87
- @logger ||= EDI::Logger.new
88
- end
89
-
90
85
  end
91
86
  include EDI::HTTPUtilities
92
87
  include EDI::Configuration
@@ -3,6 +3,7 @@ module EDI
3
3
  class Response
4
4
  require 'json'
5
5
  attr_accessor :status, :response
6
+ alias_method :code, :status
6
7
 
7
8
  def initialize(response)
8
9
  @status = response.code
@@ -17,6 +18,14 @@ module EDI
17
18
  @response
18
19
  end
19
20
 
21
+ def ok?
22
+ status == 200
23
+ end
24
+
25
+ def not_ok?
26
+ !ok?
27
+ end
28
+
20
29
  end
21
30
  end
22
31
  end
@@ -5,8 +5,12 @@ class Youtube < EDI::Service
5
5
  before_invoke :extract_search_term
6
6
 
7
7
  def run
8
- response = EDI.get("#{url}?#{params}").response
9
- "https://youtu.be/#{response["items"].first["id"]["videoId"]}"
8
+ response = EDI.get("#{url}?#{params}")
9
+ if response.ok?
10
+ "https://youtu.be/#{response.response["items"].first["id"]["videoId"]}"
11
+ else
12
+ EDI::Logger.debug response.response
13
+ end
10
14
  end
11
15
 
12
16
  private
@@ -1,3 +1,3 @@
1
1
  module EDI
2
- VERSION = "0.4.7"
2
+ VERSION = "0.4.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - DVG