telegram_notification 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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42be0982df2dcb23b61f616e4444c33961650b03a3769d0ad55548bc1dcce971
|
4
|
+
data.tar.gz: 6bdeb29cb3125fc0f68f4347e18fa97d9638b789ef18ccc62f7886a2679d0720
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5278cb3508952286e16c6064338f3678bcac097eda0e67e98b45df5a24d3d86418d4bfdfff368f7d4d7ef6aecb3172b487825c72d507304e057930493694b7c
|
7
|
+
data.tar.gz: 02fe70c37ee88ea1f165e141d3589ef7e500b5fa358ff46a9f241cc753fef21a4c05a17632196ad02dc2c6fc4c8587cc35304b14895f02599a5c55e14a27f212
|
data/Gemfile.lock
CHANGED
@@ -18,9 +18,11 @@ module TelegramNotification
|
|
18
18
|
|
19
19
|
# puts "url: #{url}, params: #{params}"
|
20
20
|
|
21
|
+
|
21
22
|
response = Net::HTTP.post(url, params, 'Content-Type': 'application/json')
|
23
|
+
response_body = JSON.parse(response.body)
|
24
|
+
return response_body["ok"] == true
|
22
25
|
|
23
|
-
JSON.parse(response.body)
|
24
26
|
end
|
25
27
|
|
26
28
|
private
|
@@ -2,12 +2,16 @@ module TelegramNotification
|
|
2
2
|
class TelegramNotification
|
3
3
|
attr_reader :client
|
4
4
|
|
5
|
-
def initialize
|
6
|
-
@client =
|
5
|
+
def initialize(options = {})
|
6
|
+
@client = ::TelegramNotification.client
|
7
7
|
end
|
8
8
|
|
9
9
|
def send_message(text)
|
10
10
|
client.post(text: text)
|
11
11
|
end
|
12
|
+
|
13
|
+
def config
|
14
|
+
@config ||= ::TelegramNotification.config
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|