flowhook 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flowhook/options.rb +8 -1
- data/lib/flowhook/streaming.rb +6 -2
- data/lib/flowhook/version.rb +1 -1
- data/lib/flowhook/worker.rb +1 -0
- metadata +2 -3
- data/flowhook.pid +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ef3accfdf817486caf58a34df33f656c6908f60
|
4
|
+
data.tar.gz: 2ff0ed28eeff44a6e50c660d239210ef1eafe4a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ad8aa207baab8269c12dade703aa2f5931498d2e8d11fb04c96661b446e915d6dab7e7acd48f8a5ddf16bb5b86551891c647b63e285792979ec604ccbd2aee
|
7
|
+
data.tar.gz: 7b2e1022a07d6440c4b53396315ff65540bca2aa22692d04859f437fa9be246b484219ebaab0441bd81e50ba1a18cce70e9b434f43a43d2bf60dba3dc0ca6bb3
|
data/lib/flowhook/options.rb
CHANGED
@@ -19,7 +19,7 @@ module Flowhook
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def setup_options
|
22
|
-
%w[url path token flows events daemonize help version].each do |option|
|
22
|
+
%w[url path token private flows events daemonize help version].each do |option|
|
23
23
|
send("setup_#{option}_option")
|
24
24
|
end
|
25
25
|
end
|
@@ -42,6 +42,12 @@ module Flowhook
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def setup_private_option
|
46
|
+
on('-P', '--[no-]private', 'Enable to receive private message') do |enabled|
|
47
|
+
options.private = enabled
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
45
51
|
def setup_flows_option
|
46
52
|
on('-F', '--flows FLOW1, FLOW2', Array, 'The flows wants to straming') do |flows|
|
47
53
|
options.flows = flows
|
@@ -79,6 +85,7 @@ module Flowhook
|
|
79
85
|
options.path = Dir.pwd
|
80
86
|
options.url = nil
|
81
87
|
options.token = nil
|
88
|
+
options.private = false
|
82
89
|
options.flows = []
|
83
90
|
options.events = []
|
84
91
|
options.daemonize = false
|
data/lib/flowhook/streaming.rb
CHANGED
@@ -3,9 +3,10 @@ module Flowhook
|
|
3
3
|
class Streaming
|
4
4
|
STREAMING_URL = 'https://stream.flowdock.com/flows'.freeze
|
5
5
|
|
6
|
-
def initialize(token, flows = [], events = [])
|
6
|
+
def initialize(token, use_private = false, flows = [], events = [])
|
7
7
|
@token = token
|
8
8
|
@flows = flows
|
9
|
+
@private = use_private ? 1 : 0
|
9
10
|
@events = events
|
10
11
|
@queue = Queue.new
|
11
12
|
@thread = nil
|
@@ -43,6 +44,7 @@ module Flowhook
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def streaming
|
47
|
+
STDOUT.puts uri
|
46
48
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
47
49
|
http.request request do |response|
|
48
50
|
response.read_body do |chunk|
|
@@ -59,7 +61,9 @@ module Flowhook
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def uri
|
62
|
-
@uri ||= URI("#{STREAMING_URL}?filter=#{@flows.join(',')}")
|
64
|
+
@uri ||= URI("#{STREAMING_URL}?filter=#{@flows.join(',')}").tap do |uri|
|
65
|
+
uri.query += '&user=1' if @private
|
66
|
+
end
|
63
67
|
end
|
64
68
|
end
|
65
69
|
end
|
data/lib/flowhook/version.rb
CHANGED
data/lib/flowhook/worker.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowhook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 蒼時弦也
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- bin/setup
|
71
71
|
- exe/flowhook
|
72
72
|
- flowhook.gemspec
|
73
|
-
- flowhook.pid
|
74
73
|
- lib/flowhook.rb
|
75
74
|
- lib/flowhook/options.rb
|
76
75
|
- lib/flowhook/streaming.rb
|
data/flowhook.pid
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
95962
|