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 +4 -4
- data/lib/edi.rb +0 -5
- data/lib/edi/api/response.rb +9 -0
- data/lib/edi/services/youtube.rb +6 -2
- data/lib/edi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14594d357a8cce0d8b55b18983ff51caa8971513
|
4
|
+
data.tar.gz: 3a5dd42a492702fce0026af80cdfa90e65dad685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/edi/api/response.rb
CHANGED
@@ -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
|
data/lib/edi/services/youtube.rb
CHANGED
@@ -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}")
|
9
|
-
|
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
|
data/lib/edi/version.rb
CHANGED