xnm-telegram 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xnm/telegram/HTTPCore.rb +7 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b56c7a24cc65be03dda2eb188715b26d24bad941c90f2f6d98b1f95bd4f672b9
4
- data.tar.gz: 7f2d2bf294f9152379c726f9a92868b562f30343019f21a5e597cfa26aa21d68
3
+ metadata.gz: a9ddabede26bf498e207b37db83c30acac27d6fbb4c8773bad9d11601493823e
4
+ data.tar.gz: 0bf434550615aa9155facc5bdae02c21a04891cd9f8b0d10b46af054c3af81c2
5
5
  SHA512:
6
- metadata.gz: 561e100a3a128011b6df5e4e44e8d3e56aac6fb297f1b9ec987fd4fdf0c31b2c04ec1ba1cbdf471935dce9228f4df2e7f04b4ed4f3d327f17ca09bd31365b193
7
- data.tar.gz: 87c30f5062838b931693acb00714dde8c6da9dc63a8745f9a6eeac24f24fb90b7641432839267cd26cb29106ccb98f8bf24b0481369b035f659faf218782e7ed
6
+ metadata.gz: 7fffa3578156d66bc2b95ef25ee44ac960a7dda85482c5355594a08ee7b4d2327285767f99454e5d4f62b0214fce1c32eb43e7ba9405e493f929c181ca13fc99
7
+ data.tar.gz: f6871001ffe6f2603a4aa166aad77e2ca809c5384126163451f71f62665a9d8f8f32ef0cbf8581ac966d0de442dc9768a6592353e46c4a155c1d86266bfb9ba6
@@ -43,9 +43,11 @@ module Telegram
43
43
  end
44
44
 
45
45
  private def _raw_post(addr, data)
46
- d_str = Shellwords.escape(data.to_json)
47
-
48
- response = `curl -s -X POST -H "Content-Type: application/json" -d #{d_str} "#{addr}"`
46
+ response = '';
47
+
48
+ IO.popen('curl', '-s', '-XPOST', '-HContent-Type: application/json', "-d#{data.to_json}", "#{addr}") do |resp|
49
+ response = resp.read
50
+ end
49
51
 
50
52
  JSON.parse(response, symbolize_names: true)
51
53
  end
@@ -61,10 +63,10 @@ module Telegram
61
63
  # Rescue-construct to prevent a HTTP error from
62
64
  # crashing our system.
63
65
  timeoutLen = data[:timeout] if data.is_a? Hash
64
- timeoutLen ||= 4;
66
+ timeoutLen ||= 3;
65
67
  retryCount = 0;
66
68
  begin
67
- Timeout.timeout(timeoutLen) do
69
+ Timeout.timeout(timeoutLen*1.3) do
68
70
  return _raw_post(call_address, _double_json_data(data));
69
71
  end
70
72
  rescue
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xnm-telegram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xasin