piped 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/piped.rb +11 -4
- data/lib/piped/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: 9b939dfa9418520febc67bbcdb7de3989cdc010b
|
4
|
+
data.tar.gz: 73adb314eff7f94686285df8a6565365b0fa7ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1b66c6b2736d71afcd95f16f3ecbc21617aece070873394835e82d9ccc62e97cd2cc425cbc26ec94ee49ae249aa6063202257c2ae7f83801aac9acd8d5c2c25
|
7
|
+
data.tar.gz: 45c5a873f7dd36fb6dd1aa2e42409f8e277eb29e54840000bbc98240c95ac5c1175de8930037620cbce01a9c0b1061294dbba9dd227a55b66ae64add92a7cffa
|
data/lib/piped.rb
CHANGED
@@ -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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
data/lib/piped/version.rb
CHANGED