streamio 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{HISTORY → HISTORY.md} +9 -5
- data/README.md +65 -0
- data/lib/streamio/model.rb +4 -4
- data/lib/streamio/version.rb +1 -1
- data/lib/streamio.rb +1 -1
- data/streamio.gemspec +4 -4
- metadata +19 -22
- data/README.rdoc +0 -53
data/{HISTORY → HISTORY.md}
RENAMED
@@ -1,14 +1,18 @@
|
|
1
|
-
|
1
|
+
# 0.9.0 2011-12-01
|
2
|
+
|
3
|
+
* Use `multi_json` gem to handle JSON parsing for maximum backend compatibility.
|
4
|
+
|
5
|
+
# 0.8.0 2011-11-22
|
2
6
|
|
3
7
|
* Player model
|
4
8
|
* Playlist model
|
5
9
|
* All models got .count action
|
6
10
|
|
7
|
-
|
11
|
+
# 0.7.0 2011-06-17
|
8
12
|
|
9
13
|
* Upload model
|
10
14
|
|
11
|
-
|
15
|
+
# 0.6.0 2011-06-17
|
12
16
|
|
13
17
|
* Model.create
|
14
18
|
* Model.destroy
|
@@ -16,10 +20,10 @@
|
|
16
20
|
* Video #add_transcoding and #delete_transcoding now reloads the video instance
|
17
21
|
* Some refactoring behind the scenes
|
18
22
|
|
19
|
-
|
23
|
+
# 0.5.1 2011-06-16
|
20
24
|
|
21
25
|
* Added lots of (YARD style) documentation and updated README
|
22
26
|
|
23
|
-
|
27
|
+
# 0.5.0 2011-06-15
|
24
28
|
|
25
29
|
* Basic api functionality for Videos, Images and Encoding Profiles
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
The Streamio Gem
|
2
|
+
================
|
3
|
+
|
4
|
+
Official ruby wrapper for the http://streamio.com API. Integrating video in your application has never been more awesome.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
``` bash
|
10
|
+
gem install streamio
|
11
|
+
```
|
12
|
+
|
13
|
+
Usage
|
14
|
+
-----
|
15
|
+
|
16
|
+
Load it.
|
17
|
+
|
18
|
+
``` ruby
|
19
|
+
require 'rubygems'
|
20
|
+
require 'streamio'
|
21
|
+
```
|
22
|
+
|
23
|
+
Configure it.
|
24
|
+
|
25
|
+
``` ruby
|
26
|
+
Streamio.configure do |config|
|
27
|
+
config.username = "your_account_name"
|
28
|
+
config.password = "your_api_private_key"
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
Use it.
|
33
|
+
|
34
|
+
``` ruby
|
35
|
+
# Fetch an array of videos
|
36
|
+
videos = Streamio::Video.all
|
37
|
+
|
38
|
+
# Pass in parameters as specified in the API docs
|
39
|
+
# This fetches the 5 most played videos tagged with Nature or Sports
|
40
|
+
videos = Streamio::Video.all(:tags => ["Nature", "Sports"], :limit => 5, :order => "plays.desc")
|
41
|
+
|
42
|
+
# Find a video by id
|
43
|
+
video = Streamio::Video.find("4c57f3975412901427000005")
|
44
|
+
|
45
|
+
# Create a video
|
46
|
+
video = Streamio::Video.new
|
47
|
+
video.save # false
|
48
|
+
video.errors # {:file => ["can't be blank"]}
|
49
|
+
video.file = File.new("my_awesome_video.mov")
|
50
|
+
video.save # true
|
51
|
+
|
52
|
+
Video.count # 23
|
53
|
+
Video.count(:tags => "Awesome") # 12
|
54
|
+
```
|
55
|
+
|
56
|
+
Same principles work for the other available models (Image, EncodingProfile, Player, Playlist and Upload).
|
57
|
+
|
58
|
+
More Documentation
|
59
|
+
------------------
|
60
|
+
|
61
|
+
YARDoc is avaible here:
|
62
|
+
http://rubydoc.info/gems/streamio
|
63
|
+
|
64
|
+
Please refer to the official Streamio API Documentation for details on parameters etc:
|
65
|
+
http://streamio.com/api/docs
|
data/lib/streamio/model.rb
CHANGED
@@ -53,7 +53,7 @@ module Streamio
|
|
53
53
|
# @return [Integer] The number of models found.
|
54
54
|
def count(parameters = {})
|
55
55
|
sanitize_parameters(parameters)
|
56
|
-
|
56
|
+
MultiJson.decode(resource["count"].get(:params => parameters))["count"]
|
57
57
|
end
|
58
58
|
|
59
59
|
def resource_name(name)
|
@@ -103,7 +103,7 @@ module Streamio
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def parse_response(response)
|
106
|
-
response =
|
106
|
+
response = MultiJson.decode(response.body)
|
107
107
|
if response.instance_of?(Array)
|
108
108
|
response.collect do |attributes|
|
109
109
|
new(attributes)
|
@@ -153,7 +153,7 @@ module Streamio
|
|
153
153
|
persist
|
154
154
|
end
|
155
155
|
rescue RestClient::UnprocessableEntity => e
|
156
|
-
@errors =
|
156
|
+
@errors = MultiJson.decode(e.response)
|
157
157
|
false
|
158
158
|
end
|
159
159
|
|
@@ -221,7 +221,7 @@ module Streamio
|
|
221
221
|
parameters[key] = @attributes[key] if @attributes.has_key?(key)
|
222
222
|
end
|
223
223
|
|
224
|
-
new_attributes =
|
224
|
+
new_attributes = MultiJson.decode(self.class.resource.post(attributes).body)
|
225
225
|
|
226
226
|
(self.class.accessable_attributes + self.class.readable_attributes).each do |attribute|
|
227
227
|
@attributes[attribute] = new_attributes[attribute]
|
data/lib/streamio/version.rb
CHANGED
data/lib/streamio.rb
CHANGED
data/streamio.gemspec
CHANGED
@@ -11,12 +11,12 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{Ruby wrapper for the Streamio API.}
|
12
12
|
s.description = %q{Ruby wrapper for Streamios API.}
|
13
13
|
|
14
|
-
s.files = Dir.glob("lib/**/*") + %w(Gemfile streamio.gemspec HISTORY README.
|
14
|
+
s.files = Dir.glob("lib/**/*") + %w(Gemfile streamio.gemspec HISTORY.md README.md)
|
15
15
|
|
16
16
|
s.add_dependency("rest-client", "~> 1.6.1")
|
17
|
-
s.add_dependency("
|
17
|
+
s.add_dependency("multi_json", "~> 1.0.4")
|
18
18
|
|
19
|
-
s.add_development_dependency("rspec", "~> 2.
|
20
|
-
s.add_development_dependency("webmock", "~> 1.
|
19
|
+
s.add_development_dependency("rspec", "~> 2.7")
|
20
|
+
s.add_development_dependency("webmock", "~> 1.7.8")
|
21
21
|
s.add_development_dependency("rake", "~> 0.9.2")
|
22
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70359592889380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,46 +21,43 @@ dependencies:
|
|
21
21
|
version: 1.6.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70359592889380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: multi_json
|
27
|
+
requirement: &70359592888660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '1.4'
|
33
|
-
- - <
|
30
|
+
- - ~>
|
34
31
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
32
|
+
version: 1.0.4
|
36
33
|
type: :runtime
|
37
34
|
prerelease: false
|
38
|
-
version_requirements: *
|
35
|
+
version_requirements: *70359592888660
|
39
36
|
- !ruby/object:Gem::Dependency
|
40
37
|
name: rspec
|
41
|
-
requirement: &
|
38
|
+
requirement: &70359592888000 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
40
|
requirements:
|
44
41
|
- - ~>
|
45
42
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
43
|
+
version: '2.7'
|
47
44
|
type: :development
|
48
45
|
prerelease: false
|
49
|
-
version_requirements: *
|
46
|
+
version_requirements: *70359592888000
|
50
47
|
- !ruby/object:Gem::Dependency
|
51
48
|
name: webmock
|
52
|
-
requirement: &
|
49
|
+
requirement: &70359592887540 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
51
|
requirements:
|
55
52
|
- - ~>
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version: 1.
|
54
|
+
version: 1.7.8
|
58
55
|
type: :development
|
59
56
|
prerelease: false
|
60
|
-
version_requirements: *
|
57
|
+
version_requirements: *70359592887540
|
61
58
|
- !ruby/object:Gem::Dependency
|
62
59
|
name: rake
|
63
|
-
requirement: &
|
60
|
+
requirement: &70359592887080 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
62
|
requirements:
|
66
63
|
- - ~>
|
@@ -68,7 +65,7 @@ dependencies:
|
|
68
65
|
version: 0.9.2
|
69
66
|
type: :development
|
70
67
|
prerelease: false
|
71
|
-
version_requirements: *
|
68
|
+
version_requirements: *70359592887080
|
72
69
|
description: Ruby wrapper for Streamios API.
|
73
70
|
email:
|
74
71
|
- david@streamio.se
|
@@ -87,8 +84,8 @@ files:
|
|
87
84
|
- lib/streamio.rb
|
88
85
|
- Gemfile
|
89
86
|
- streamio.gemspec
|
90
|
-
- HISTORY
|
91
|
-
- README.
|
87
|
+
- HISTORY.md
|
88
|
+
- README.md
|
92
89
|
homepage: http://github.com/streamio/streamio-rb
|
93
90
|
licenses: []
|
94
91
|
post_install_message:
|
data/README.rdoc
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
= The Streamio Gem
|
2
|
-
|
3
|
-
Official ruby wrapper for the http://streamio.com API. Integrating video in your application has never been more awesome.
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
gem install streamio
|
8
|
-
|
9
|
-
== Usage
|
10
|
-
|
11
|
-
Load it.
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'streamio'
|
15
|
-
|
16
|
-
Configure it.
|
17
|
-
|
18
|
-
Streamio.configure do |config|
|
19
|
-
config.username = "your_account_name"
|
20
|
-
config.password = "your_api_private_key"
|
21
|
-
end
|
22
|
-
|
23
|
-
Use it.
|
24
|
-
|
25
|
-
# Fetch an array of videos
|
26
|
-
videos = Streamio::Video.all
|
27
|
-
|
28
|
-
# Pass in parameters as specified in the API docs
|
29
|
-
# This fetches the 5 most played videos tagged with Nature or Sports
|
30
|
-
videos = Streamio::Video.all(:tags => ["Nature", "Sports"], :limit => 5, :order => "plays.desc")
|
31
|
-
|
32
|
-
# Find a video by id
|
33
|
-
video = Streamio::Video.find("4c57f3975412901427000005")
|
34
|
-
|
35
|
-
# Create a video
|
36
|
-
video = Streamio::Video.new
|
37
|
-
video.save # false
|
38
|
-
video.errors # {:file => ["can't be blank"]}
|
39
|
-
video.file = File.new("my_awesome_video.mov")
|
40
|
-
video.save # true
|
41
|
-
|
42
|
-
Video.count # 23
|
43
|
-
Video.count(:tags => "Awesome") # 12
|
44
|
-
|
45
|
-
Same principles work for the other availible models (Image, EncodingProfile, Player, Playlist and Upload).
|
46
|
-
|
47
|
-
== More Documentation
|
48
|
-
|
49
|
-
YARDoc is avaible here:
|
50
|
-
http://rubydoc.info/gems/streamio
|
51
|
-
|
52
|
-
Please refer to the official Streamio API Documentation for details on parameters etc:
|
53
|
-
http://streamio.com/api/docs
|