cine_io 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,9 @@
1
1
  class CineIo::StreamsHandler < CineIo::ResourceHandler
2
2
 
3
+ def index
4
+ get_resource("/streams").map(&CineIo::Stream.method(:new))
5
+ end
6
+
3
7
  def get(stream_id)
4
8
  CineIo::Stream.new get_resource("/stream", id: stream_id)
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module CineIo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -25,6 +25,27 @@ describe CineIo::StreamsHandler do
25
25
  end
26
26
  end
27
27
 
28
+ describe '#streams' do
29
+ it "returns the streams" do
30
+ VCR.use_cassette('get_streams') do
31
+ streams = subject.index
32
+ expect(streams).to have(1).item
33
+ stream = streams.first
34
+ expect(stream).to be_a(CineIo::Stream)
35
+ expect(stream.id).to eq("53718cef450ff80200f81856")
36
+ expect(stream.password).to eq("THEPASSWORD")
37
+ expect(stream.play.keys.sort).to eq(['hls', 'rtmp'])
38
+ expect(stream.publish.keys.sort).to eq(['stream', 'url'])
39
+ end
40
+ end
41
+
42
+ it 'can throw an error on api exception' do
43
+ VCR.use_cassette('get_streams_error', record: :once) do
44
+ expect {subject.index}.to raise_error(CineIo::ApiError, "An unknown error has occured.")
45
+ end
46
+ end
47
+ end
48
+
28
49
  describe '#create' do
29
50
  it "returns a stream" do
30
51
  VCR.use_cassette('create_stream') do
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.cine.io/api/1/-/streams?secretKey=MY%20SECRET
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Content-Type:
20
+ - application/json; charset=utf-8
21
+ Date:
22
+ - Sun, 01 Jun 2014 23:00:30 GMT
23
+ Etag:
24
+ - ! '"141729763"'
25
+ Set-Cookie:
26
+ - connect.sid=s%3AmCygPst4k0FvNgN7v0iUWSzA.9SXtKjamHPmkxX%2F1xf6t87xWvgH1fGBmZoIwN7Rizck;
27
+ Path=/; HttpOnly
28
+ Vary:
29
+ - Accept-Encoding
30
+ X-Powered-By:
31
+ - Express
32
+ Content-Length:
33
+ - '381'
34
+ Connection:
35
+ - keep-alive
36
+ body:
37
+ encoding: US-ASCII
38
+ string: ! '[{"id":"53718cef450ff80200f81856","name":"cine1","play":{"hls":"http://hls.cine.io/cines/cine1/cine1.m3u8","rtmp":"rtmp://fml.cine.io/20C45E/cines/cine1?adbe-live-event=cine1"},"publish":{"url":"rtmp://stream.lax.cine.io/20C45E/cines","stream":"cine1?THEPASSWORD&amp;adbe-live-event=cine1"},"password":"THEPASSWORD","expiration":"2034-05-13T00:00:00.000Z","assignedAt":"2014-05-13T03:24:07.916Z"}]'
39
+ http_version:
40
+ recorded_at: Sun, 01 Jun 2014 23:00:30 GMT
41
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.cine.io/api/1/-/streams?secretKey=MY%20SECRET
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 400
17
+ message: Bad Request
18
+ headers:
19
+ Content-Type:
20
+ - text/html; charset=utf-8
21
+ Date:
22
+ - Sun, 01 Jun 2014 23:03:47 GMT
23
+ Etag:
24
+ - ! '"-585839348"'
25
+ Set-Cookie:
26
+ - connect.sid=s%3AKC9zAanqovojKCzHHLfhV3SF.j9HEpMhw2nEBGIlm4%2Frx5xhlJHLd6lWp4LG%2FXSDNfRo;
27
+ Path=/; HttpOnly
28
+ Vary:
29
+ - Accept-Encoding
30
+ X-Powered-By:
31
+ - Express
32
+ Content-Length:
33
+ - '29'
34
+ Connection:
35
+ - keep-alive
36
+ body:
37
+ encoding: US-ASCII
38
+ string: An unknown error has occured.
39
+ http_version:
40
+ recorded_at: Sun, 01 Jun 2014 23:03:47 GMT
41
+ recorded_with: VCR 2.3.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cine_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -123,6 +123,8 @@ files:
123
123
  - spec/fixtures/vcr_cassettes/get_project_error.yml
124
124
  - spec/fixtures/vcr_cassettes/get_stream.yml
125
125
  - spec/fixtures/vcr_cassettes/get_stream_error.yml
126
+ - spec/fixtures/vcr_cassettes/get_streams.yml
127
+ - spec/fixtures/vcr_cassettes/get_streams_error.yml
126
128
  - spec/spec_helper.rb
127
129
  homepage: ''
128
130
  licenses:
@@ -161,4 +163,6 @@ test_files:
161
163
  - spec/fixtures/vcr_cassettes/get_project_error.yml
162
164
  - spec/fixtures/vcr_cassettes/get_stream.yml
163
165
  - spec/fixtures/vcr_cassettes/get_stream_error.yml
166
+ - spec/fixtures/vcr_cassettes/get_streams.yml
167
+ - spec/fixtures/vcr_cassettes/get_streams_error.yml
164
168
  - spec/spec_helper.rb