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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7bcfdbc2cb07e551d37703c5a5468151c64b4df
4
- data.tar.gz: b5375b70f1fd8e3e7fb6575f72ba6befde09764c
3
+ metadata.gz: 6aa5741c412e859b6e59345cb3f596fd3b78619c
4
+ data.tar.gz: 98cbf69cae35fcc9f8d4aaae380970157ea137ca
5
5
  SHA512:
6
- metadata.gz: d1185974ff919bd69527b1fdbc361578af8aef7ae1551e7742ab088c2740361f027f44ee982877741a65a1bafb08de0dcc12c32c9bba3c4c86c9273f92d05d83
7
- data.tar.gz: ddafcc63bcce5582ee7a3a71d13787cfc9ce70c562466db077ce220fcd588e33ba312554862f330c64044cec4ad4a50830e0def32d220598bfd69910a45f6dc2
6
+ metadata.gz: c06ef5f1ddaacb9e89c656a5398cb455dfca9a9b20e1e9fb645587b064fa71564a432cf5614a14e06d204a6902c6680c05e90b68efd8f92ecd2479fc674b6786
7
+ data.tar.gz: 480550384a0b6881130727db28b7764ae0dda9977e5f2d8caaca4f1c5efba365029e80b9765bf590cb801acdf33d286affd3b75b461be493e3cc54409f9da3de
@@ -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
@@ -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/0.1/'
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)
@@ -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']
@@ -1,3 +1,3 @@
1
1
  module Matroid
2
- VERSION = "0.0.3"
2
+ VERSION = "1.0.0"
3
3
  end
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.3
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-04-24 00:00:00.000000000 Z
11
+ date: 2017-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2