matroid 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/matroid.rb +11 -0
- data/lib/matroid/connection.rb +1 -1
- data/lib/matroid/detector.rb +15 -0
- data/lib/matroid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa5741c412e859b6e59345cb3f596fd3b78619c
|
4
|
+
data.tar.gz: 98cbf69cae35fcc9f8d4aaae380970157ea137ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06ef5f1ddaacb9e89c656a5398cb455dfca9a9b20e1e9fb645587b064fa71564a432cf5614a14e06d204a6902c6680c05e90b68efd8f92ecd2479fc674b6786
|
7
|
+
data.tar.gz: 480550384a0b6881130727db28b7764ae0dda9977e5f2d8caaca4f1c5efba365029e80b9765bf590cb801acdf33d286affd3b75b461be493e3cc54409f9da3de
|
data/lib/matroid.rb
CHANGED
@@ -78,5 +78,16 @@ module Matroid
|
|
78
78
|
get("videos/#{video_id}", *args)
|
79
79
|
end
|
80
80
|
|
81
|
+
# Registers a new stream on Matroid
|
82
|
+
# @param stream_url [String] the url for the stream
|
83
|
+
# @param stream_name [String] the name of the stream
|
84
|
+
# @return Hash containing the id of the stream { "stream_id" => "123" }
|
85
|
+
def register_stream(stream_url, stream_name)
|
86
|
+
register_err = "Must include a url and name for stream"
|
87
|
+
raise Error::InvalidQueryError.new(register_err) unless stream_url && stream_name
|
88
|
+
Matroid.post("feeds", name: stream_name, url: stream_url)
|
89
|
+
end
|
90
|
+
|
91
|
+
|
81
92
|
end
|
82
93
|
end
|
data/lib/matroid/connection.rb
CHANGED
@@ -4,7 +4,7 @@ require 'httpclient/webagent-cookie' # stops warning found here: https://github.
|
|
4
4
|
require 'httpclient'
|
5
5
|
require 'date'
|
6
6
|
|
7
|
-
BASE_API_URI = 'https://www.matroid.com/api/
|
7
|
+
BASE_API_URI = 'https://www.matroid.com/api/v1/'
|
8
8
|
DEFAULT_GRANT_TYPE = 'client_credentials'
|
9
9
|
TOKEN_RESOURCE = 'oauth/token'
|
10
10
|
VERBS = %w(get post)
|
data/lib/matroid/detector.rb
CHANGED
@@ -258,6 +258,21 @@ module Matroid
|
|
258
258
|
classify('video', file: File.new(file_path, 'rb'))
|
259
259
|
end
|
260
260
|
|
261
|
+
# Monitor an existing stream on Matroid with your detector
|
262
|
+
# @param stream_id [String] the id for the stream to monitor with the detector
|
263
|
+
# @param thresholds [Hash] contains the keys for each label and the score cutoff for a notification. Example: { cat: 0.6, dog: 0.9 }
|
264
|
+
# @param options [Hash] contains startTime, endTime [ISO strings], and endpoint [String]. The HTTP endpoint is called whenever there is a detection
|
265
|
+
# @return Hash containing the stream_id and monitoring_id
|
266
|
+
def monitor_stream(stream_id, thresholds, options = {})
|
267
|
+
monitor_err = "Must include stream id"
|
268
|
+
raise Error::InvalidQueryError.new(monitor_err) unless stream_id
|
269
|
+
params = {
|
270
|
+
thresholds: thresholds.to_json
|
271
|
+
}
|
272
|
+
params = params.merge(options)
|
273
|
+
Matroid.post("feeds/#{stream_id}/monitor/#{@id}", params)
|
274
|
+
end
|
275
|
+
|
261
276
|
def update_params(params)
|
262
277
|
@id = params['id'] if params['id']
|
263
278
|
@name = params['name'] if params['name']
|
data/lib/matroid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matroid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matroid
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|