cine_io 0.0.2 → 0.0.3
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.
- data/.travis.yml +6 -0
- data/README.md +50 -2
- data/cine_io.gemspec +2 -2
- data/lib/cine_io/streams_handler.rb +4 -0
- data/lib/cine_io/version.rb +1 -1
- data/spec/cine_io/project_spec.rb +1 -1
- data/spec/cine_io/projects_handler_spec.rb +1 -1
- data/spec/cine_io/stream_spec.rb +1 -1
- data/spec/cine_io/streams_handler_spec.rb +17 -1
- data/spec/cine_io_spec.rb +2 -2
- data/spec/fixtures/vcr_cassettes/get_fmle_profile.yml +41 -0
- data/spec/fixtures/vcr_cassettes/get_fmle_profile_error.yml +41 -0
- metadata +9 -4
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# cine.io ruby gem
|
2
|
+
|
3
|
+
[](https://travis-ci.org/cine-io/cineio-ruby)
|
2
4
|
|
3
5
|
The ruby gem for [cine.io](cine.io).
|
4
6
|
|
@@ -18,7 +20,53 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
### Initialization
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require('cine_io')
|
27
|
+
client = CineIo::Client.new(secretKey: 'YOUR_SECRET_KEY')
|
28
|
+
```
|
29
|
+
|
30
|
+
### Methods
|
31
|
+
|
32
|
+
#### Projects
|
33
|
+
|
34
|
+
To get data about your project:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
project = client.project.get
|
38
|
+
# => CineIo::Project
|
39
|
+
```
|
40
|
+
|
41
|
+
#### Streams
|
42
|
+
|
43
|
+
To get all your streams:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
streams = client.streams.index
|
47
|
+
# => [CineIo::Stream, …]
|
48
|
+
```
|
49
|
+
|
50
|
+
To get a specific stream:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
stream = client.streams.get('STREAM_ID')
|
54
|
+
# => CineIo::Stream
|
55
|
+
```
|
56
|
+
|
57
|
+
To create a new stream:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
stream = client.streams.create
|
61
|
+
# => CineIo::Stream
|
62
|
+
```
|
63
|
+
|
64
|
+
To fetch the [Flash Media Live Encoder](http://www.adobe.com/products/flash-media-encoder.html) profile for a stream:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
stream = client.streams.fmle_profile('STREAM_ID')
|
68
|
+
# => String of profile contents
|
69
|
+
```
|
22
70
|
|
23
71
|
## Contributing
|
24
72
|
|
data/cine_io.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "cine_io"
|
8
8
|
spec.version = CineIo::VERSION
|
9
9
|
spec.authors = ["cine.io"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["engineering@cine.io"]
|
11
11
|
spec.description = %q{cine.io is an api driven platform for creating and publish live streams. The provides cine.io functionality using your given public and secret keys.}
|
12
12
|
spec.summary = %q{The official cine.io ruby gem}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/cine-io/cineio-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -8,6 +8,10 @@ class CineIo::StreamsHandler < CineIo::ResourceHandler
|
|
8
8
|
CineIo::Stream.new get_resource("/stream", id: stream_id)
|
9
9
|
end
|
10
10
|
|
11
|
+
def fmle_profile(stream_id)
|
12
|
+
get_resource("/stream", id: stream_id, fmleProfile: true).fetch('content')
|
13
|
+
end
|
14
|
+
|
11
15
|
def create
|
12
16
|
CineIo::Stream.new post_resource("/stream")
|
13
17
|
end
|
data/lib/cine_io/version.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe CineIo::ProjectsHandler do
|
4
4
|
|
5
|
-
let(:client) { CineIo::Client.new(secretKey
|
5
|
+
let(:client) { CineIo::Client.new(:secretKey => "MY SECRET", :publicKey => "MY PUBLIC") }
|
6
6
|
|
7
7
|
subject { described_class.new(client) }
|
8
8
|
|
data/spec/cine_io/stream_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe CineIo::StreamsHandler do
|
4
4
|
|
5
|
-
let(:client) { CineIo::Client.new(secretKey
|
5
|
+
let(:client) { CineIo::Client.new(:secretKey => "MY SECRET", :publicKey => "MY PUBLIC") }
|
6
6
|
|
7
7
|
subject { described_class.new(client) }
|
8
8
|
|
@@ -25,6 +25,22 @@ describe CineIo::StreamsHandler do
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
describe '#fmle_profile' do
|
29
|
+
it "returns a fmle profile" do
|
30
|
+
VCR.use_cassette('get_fmle_profile') do
|
31
|
+
profile = subject.fmle_profile("537bee46bc03be080085a38a")
|
32
|
+
expect(profile).to be_a(String)
|
33
|
+
expect(profile).to include("flashmedialiveencoder_profile")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'can throw an error on api exception' do
|
38
|
+
VCR.use_cassette('get_fmle_profile_error', record: :once) do
|
39
|
+
expect {subject.get("NOT_AN_ID")}.to raise_error(CineIo::ApiError, "An unknown error has occured.")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
28
44
|
describe '#streams' do
|
29
45
|
it "returns the streams" do
|
30
46
|
VCR.use_cassette('get_streams') do
|
data/spec/cine_io_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe CineIo do
|
4
|
-
let(:client) { CineIo::Client.new(publicKey
|
4
|
+
let(:client) { CineIo::Client.new(:publicKey => 'My public key', :secretKey => 'My secret key') }
|
5
5
|
subject { client }
|
6
6
|
|
7
7
|
it 'takes a public and secret key' do
|
8
|
-
expect(subject.config).to eq(publicKey
|
8
|
+
expect(subject.config).to eq(:publicKey => 'My public key', :secretKey => 'My secret key')
|
9
9
|
end
|
10
10
|
describe '#projects' do
|
11
11
|
subject {client.project}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://www.cine.io/api/1/-/stream?fmleProfile=true&id=537bee46bc03be080085a38a&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
|
+
- Tue, 03 Jun 2014 18:45:36 GMT
|
23
|
+
Etag:
|
24
|
+
- ! '"-1884831062"'
|
25
|
+
Set-Cookie:
|
26
|
+
- connect.sid=s%3AJaTfbZZFDtxLdRHfE5ASdnpH.czSW8SNkmM9Ax5Tk%2B2UV0iyvxLo%2BMZelXghmAkWkhJo;
|
27
|
+
Path=/; HttpOnly
|
28
|
+
Vary:
|
29
|
+
- Accept-Encoding
|
30
|
+
X-Powered-By:
|
31
|
+
- Express
|
32
|
+
Content-Length:
|
33
|
+
- '2330'
|
34
|
+
Connection:
|
35
|
+
- keep-alive
|
36
|
+
body:
|
37
|
+
encoding: US-ASCII
|
38
|
+
string: ! '{"content":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<flashmedialiveencoder_profile>THE PROFILE</flashmedialiveencoder_profile>\n"}'
|
39
|
+
http_version:
|
40
|
+
recorded_at: Tue, 03 Jun 2014 18:45:36 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/-/stream?id=NOT_AN_ID&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
|
+
- Tue, 03 Jun 2014 18:47:08 GMT
|
23
|
+
Etag:
|
24
|
+
- ! '"-585839348"'
|
25
|
+
Set-Cookie:
|
26
|
+
- connect.sid=s%3AQHHKUGLaw40CPg3J6BFevR8U.PEqu3mFEqIf5v%2FVLr9DlaIWphceyM%2BSA1ZcNeDBOAJ0;
|
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: Tue, 03 Jun 2014 18:47:08 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.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -94,12 +94,13 @@ dependencies:
|
|
94
94
|
description: cine.io is an api driven platform for creating and publish live streams.
|
95
95
|
The provides cine.io functionality using your given public and secret keys.
|
96
96
|
email:
|
97
|
-
-
|
97
|
+
- engineering@cine.io
|
98
98
|
executables: []
|
99
99
|
extensions: []
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
102
|
- .gitignore
|
103
|
+
- .travis.yml
|
103
104
|
- Gemfile
|
104
105
|
- LICENSE.txt
|
105
106
|
- README.md
|
@@ -119,6 +120,8 @@ files:
|
|
119
120
|
- spec/cine_io_spec.rb
|
120
121
|
- spec/fixtures/vcr_cassettes/create_stream.yml
|
121
122
|
- spec/fixtures/vcr_cassettes/create_stream_error.yml
|
123
|
+
- spec/fixtures/vcr_cassettes/get_fmle_profile.yml
|
124
|
+
- spec/fixtures/vcr_cassettes/get_fmle_profile_error.yml
|
122
125
|
- spec/fixtures/vcr_cassettes/get_project.yml
|
123
126
|
- spec/fixtures/vcr_cassettes/get_project_error.yml
|
124
127
|
- spec/fixtures/vcr_cassettes/get_stream.yml
|
@@ -126,7 +129,7 @@ files:
|
|
126
129
|
- spec/fixtures/vcr_cassettes/get_streams.yml
|
127
130
|
- spec/fixtures/vcr_cassettes/get_streams_error.yml
|
128
131
|
- spec/spec_helper.rb
|
129
|
-
homepage:
|
132
|
+
homepage: https://github.com/cine-io/cineio-ruby
|
130
133
|
licenses:
|
131
134
|
- MIT
|
132
135
|
post_install_message:
|
@@ -159,6 +162,8 @@ test_files:
|
|
159
162
|
- spec/cine_io_spec.rb
|
160
163
|
- spec/fixtures/vcr_cassettes/create_stream.yml
|
161
164
|
- spec/fixtures/vcr_cassettes/create_stream_error.yml
|
165
|
+
- spec/fixtures/vcr_cassettes/get_fmle_profile.yml
|
166
|
+
- spec/fixtures/vcr_cassettes/get_fmle_profile_error.yml
|
162
167
|
- spec/fixtures/vcr_cassettes/get_project.yml
|
163
168
|
- spec/fixtures/vcr_cassettes/get_project_error.yml
|
164
169
|
- spec/fixtures/vcr_cassettes/get_stream.yml
|