telegram_notification 0.1.0 → 0.1.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
  SHA256:
3
- metadata.gz: 33dcecfbcf3478785f6327fa10994d9247a20cc7e597e847cddd4f04de29e83f
4
- data.tar.gz: 06ba87834005ccf6e6b960ed7f73a2e0d4d33fb0babb58a935a9a3736c382dd0
3
+ metadata.gz: 42be0982df2dcb23b61f616e4444c33961650b03a3769d0ad55548bc1dcce971
4
+ data.tar.gz: 6bdeb29cb3125fc0f68f4347e18fa97d9638b789ef18ccc62f7886a2679d0720
5
5
  SHA512:
6
- metadata.gz: 8873378c1357020f33756953bdc166255f4a12c02e69577aa19d5352d0e1c998a0aa7c191bc1802a64d08a8c7c746293f1439195cfdb346f4633d1771db5f021
7
- data.tar.gz: ad45312702731d3cc50ec55d4b3edf4066f36d75d57414f4f03185d1c38dd784a50701470f4f8cf5502045864fe0a2f02eb4ea4b8a8eb7bfdd59ffc196969801
6
+ metadata.gz: c5278cb3508952286e16c6064338f3678bcac097eda0e67e98b45df5a24d3d86418d4bfdfff368f7d4d7ef6aecb3172b487825c72d507304e057930493694b7c
7
+ data.tar.gz: 02fe70c37ee88ea1f165e141d3589ef7e500b5fa358ff46a9f241cc753fef21a4c05a17632196ad02dc2c6fc4c8587cc35304b14895f02599a5c55e14a27f212
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- telegram_notification (0.1.0)
4
+ telegram_notification (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -16,4 +16,12 @@ module TelegramNotification
16
16
  yield config
17
17
  @config
18
18
  end
19
+
20
+ def self.client
21
+ @client ||= ::TelegramNotification::Client.new
22
+ end
23
+
24
+ def self.new(*options)
25
+ ::TelegramNotification::TelegramNotification.new(*options)
26
+ end
19
27
  end
@@ -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 = Client.new
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TelegramNotification
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram_notification
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
  - civil21