piped 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/piped.rb +11 -4
  3. data/lib/piped/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fb1e07adebfb648f2565b49e8c574cb689ca978
4
- data.tar.gz: 770349449a4456ae7de38a47af49bd907aa3c458
3
+ metadata.gz: 9b939dfa9418520febc67bbcdb7de3989cdc010b
4
+ data.tar.gz: 73adb314eff7f94686285df8a6565365b0fa7ba3
5
5
  SHA512:
6
- metadata.gz: 5d466b346222415a78d12945f4b85e20c03e4eff50085852946ca46c6a488d318eaad5c0e671b9c3be90bb4b715557aa185e8c6a21325d7bf9ec037b431e1cea
7
- data.tar.gz: fcf58a5ba29546c40b42cdf1b27a783649c16c44e8e66900a4be95cbb54a305e2afb1e829fd4604adf30d7fd378a3b48cd92dc9c850a8b9a7651812adc7a0236
6
+ metadata.gz: f1b66c6b2736d71afcd95f16f3ecbc21617aece070873394835e82d9ccc62e97cd2cc425cbc26ec94ee49ae249aa6063202257c2ae7f83801aac9acd8d5c2c25
7
+ data.tar.gz: 45c5a873f7dd36fb6dd1aa2e42409f8e277eb29e54840000bbc98240c95ac5c1175de8930037620cbce01a9c0b1061294dbba9dd227a55b66ae64add92a7cffa
@@ -4,6 +4,8 @@ require 'rest-client'
4
4
  require 'hashie'
5
5
 
6
6
  module Piped
7
+ REQUEST_TIMEOUT = 60
8
+ OPEN_TIMEOUT = 5
7
9
  @@api_key = "SET_YOUR_API_KEY"
8
10
  @@piped_host = nil # Optional
9
11
 
@@ -23,11 +25,16 @@ module Piped
23
25
  def self.push(options={})
24
26
  api_key = options.delete(:api_key) || @@api_key
25
27
  host = options.delete(:pipeman_host) || self.pipeman_host
26
- response = RestClient.post(
27
- "#{host}/events",
28
- options,
29
- {"Authorization" => "Bearer #{api_key}", :content_type => :json, :accept => :json}
28
+
29
+ response = RestClient::Request.execute(
30
+ method: :post,
31
+ url: "#{host}/events",
32
+ payload: JSON.generate(options),
33
+ headers: {"Authorization" => "Bearer #{api_key}", :content_type => :json, :accept => :json},
34
+ timeout: REQUEST_TIMEOUT,
35
+ open_timeout: OPEN_TIMEOUT
30
36
  )
37
+
31
38
  Hashie::Mash.new(JSON.parse(response))
32
39
  end
33
40
  end
@@ -1,3 +1,3 @@
1
1
  module Piped
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piped
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Luk