three_sixty 1.0.0 → 1.0.1
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/CHANGELOG +3 -1
- data/HOW_TO_BUILD.txt +26 -0
- data/Manifest +3 -1
- data/Rakefile +1 -1
- data/lib/sorenson/threesixty/asset.rb +154 -128
- data/three_sixty.gemspec +2 -2
- metadata +3 -2
data/CHANGELOG
CHANGED
data/HOW_TO_BUILD.txt
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
1. GET INTO THIS DIRECTORY
|
|
2
|
+
cd three_sixty_gem
|
|
3
|
+
|
|
4
|
+
1.5. MAKE SURE YOU INCREMENT THE VERSION NUMBER in the Rakefile!!:);)!!!!!
|
|
5
|
+
|
|
6
|
+
2. BUILD THE MANIFEST FILE
|
|
7
|
+
rake manifest
|
|
8
|
+
|
|
9
|
+
3. BUILD THE GEMSPEC (BE SURE TO INCREMENT THE VERSION # IN RAKEFILE)
|
|
10
|
+
rake build_gemspec
|
|
11
|
+
|
|
12
|
+
4. INSTALL THE GEM LOCALLY TO TEST
|
|
13
|
+
rake install three_sixty.gemspec
|
|
14
|
+
|
|
15
|
+
5. CREATE THE GEM INTO PKG DIRECTORY
|
|
16
|
+
rake gem
|
|
17
|
+
|
|
18
|
+
6. GET INTO PKG DIRECTOY
|
|
19
|
+
cd pkg
|
|
20
|
+
|
|
21
|
+
7. PUSH GEM TO GEMCUTTER (MAKE SURE GEMCUTTER GEM IS INSTALLED)
|
|
22
|
+
gem install gemcutter (IF NEEDED)
|
|
23
|
+
gem push three_sixty-0.0.XXXXXXXXXX.gem (MAKE SURE YOU INCREMENTED THE VERSION NUMBER in the Rakefile!!!)
|
|
24
|
+
|
|
25
|
+
8. INSTALL THE FINISHED GEM LOCALLY
|
|
26
|
+
gem install three_sixty
|
data/Manifest
CHANGED
data/Rakefile
CHANGED
|
@@ -7,7 +7,7 @@ require 'cucumber'
|
|
|
7
7
|
require 'cucumber/rake/task'
|
|
8
8
|
require 'echoe'
|
|
9
9
|
|
|
10
|
-
Echoe.new('three_sixty', '1.0.
|
|
10
|
+
Echoe.new('three_sixty', '1.0.1') do |p|
|
|
11
11
|
p.description = "Ruby bindings for Sorenson 360 Backend"
|
|
12
12
|
p.url = "https://github.com/sorenson/ThreeSixtyServices-Internal"
|
|
13
13
|
p.author = "Sorenson Media"
|
|
@@ -1,152 +1,178 @@
|
|
|
1
|
+
# Sorenson Namespace
|
|
1
2
|
module Sorenson
|
|
2
|
-
|
|
3
|
+
# Sorenson Services Namespace
|
|
4
|
+
module Services
|
|
5
|
+
# Allows you to access the resources associated with a sorenson services asset. An asset currently refers to video content.
|
|
3
6
|
class Asset < Base
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
attr_accessor :
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def self.get_embed_codes(video_guid, sessionId, account)
|
|
27
|
-
data = post_to("/api/getAllEmbedcodes?vguid=#{video_guid}&sessionId=#{account.sessionId}")
|
|
28
|
-
data['embedList']
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.get_streaming_server_url
|
|
32
|
-
"rtmp://cdnstreamingvideos.sorensonmedia.com/cfx/st"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Instance Methods
|
|
36
|
-
def initialize(account, data)
|
|
37
|
-
self.account = account
|
|
38
|
-
self.presetXml = data['presetXml']
|
|
39
|
-
self.subaccountId = data['subaccountId']
|
|
40
|
-
self.encodeDate = data['encodeDate']
|
|
41
|
-
self.frameRate = data['frameRate']
|
|
42
|
-
self.height = data['height']
|
|
43
|
-
self.dateLastModified = data['dateLastModified']
|
|
44
|
-
self.videoBitrateMode = data['videoBitrateMode']
|
|
45
|
-
self.mediaType = data['mediaType']
|
|
46
|
-
self.id = data['id']
|
|
47
|
-
self.accountId = data['accountId']
|
|
48
|
-
self.numberOfViews = data['numberOfViews']
|
|
49
|
-
self.application = data['application']
|
|
50
|
-
self.audioCodec = data['audioCodec']
|
|
51
|
-
self.permalinkLocation = data['permalink']
|
|
52
|
-
self.status = data['status']
|
|
53
|
-
self.description = data['description']
|
|
54
|
-
self.videoDuration = data['videoDuration']
|
|
55
|
-
self.abstractFileId = data['abstractFileId']
|
|
56
|
-
self.versionId = data['versionId']
|
|
57
|
-
self.dateRetrieved = data['dateRetrieved']
|
|
58
|
-
self.audioDataRate = data['audioDataRate']
|
|
59
|
-
self.audioBitrateMode = data['audioBitrateMode']
|
|
60
|
-
self.videoCodec = data['videoCodec']
|
|
61
|
-
self.displayName = data['displayName']
|
|
62
|
-
self.name = data['name']
|
|
63
|
-
self.videoDataRate = data['videoDataRate']
|
|
64
|
-
self.authorId = data['authorId']
|
|
65
|
-
self.width = data['width']
|
|
66
|
-
self.fileSize = data['fileSize']
|
|
67
|
-
self.thumbnailImageUrl = data['thumbnail']['httpLocation'] if data['thumbnail']
|
|
68
|
-
self.thumbnailImageUrl = data['thumbLocation'] if data['thumbLocation']
|
|
69
|
-
self.httpLocation = data['httpLocation']
|
|
70
|
-
self.directAssetUrl = "http://360.sorensonmedia.com/redirector/fetchFile?vguid=#{self.id}"
|
|
71
|
-
self.videoGuid
|
|
72
|
-
|
|
73
|
-
self.filters = []
|
|
74
|
-
if data['filters']
|
|
75
|
-
data['filters'].each do |filter|
|
|
76
|
-
self.filters << filter['filterDescription']
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
self.embedList = {}
|
|
81
|
-
get_embed_codes
|
|
82
|
-
|
|
83
|
-
self.videoGuid = self.embedList.empty? ? nil : self.embedList.first[1].match(/videoGUID=(.*?)&/)[1]
|
|
8
|
+
|
|
9
|
+
attr_accessor :encode_date, :frame_rate, :height, :date_last_modified, :video_bitrate_mode,
|
|
10
|
+
:media_type, :id, :account_id, :number_of_views, :application, :audio_codec,
|
|
11
|
+
:permalink_location, :status, :description, :video_duration, :abstract_file_id, :version_id,
|
|
12
|
+
:date_retrieved, :audio_data_rate, :audio_bitrate_mode, :video_codec, :display_name, :name,
|
|
13
|
+
:video_data_rate, :author_id, :width, :file_size, :thumbnail_image_url, :direct_asset_url,
|
|
14
|
+
:password, :metadata, :embed_list, :group_id, :video_guid, :streaming_server_and_video_path
|
|
15
|
+
|
|
16
|
+
# Get all of the assets as a list of guids. Use offset and quantity to return subsets.
|
|
17
|
+
# Sorenson::Services::Account.login('username', 'password')
|
|
18
|
+
# assets = Sorenson::Services::Asset.all
|
|
19
|
+
# names = assets.collect {|asset| asset.name}
|
|
20
|
+
# => names = ["name1", "name2"]
|
|
21
|
+
def self.all(offset = nil, quantity = nil)
|
|
22
|
+
list = get_from("/assets", :offset => offset, :quantity => quantity)["asset_list"]
|
|
23
|
+
list.collect {|a| new(a) }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Get a list of asset guids by passing a tag name
|
|
27
|
+
def self.find_all_by_tag(tag_name)
|
|
28
|
+
get_from("/tags/#{tag_name}/assets", :account_id => account_id)
|
|
84
29
|
end
|
|
85
30
|
|
|
86
|
-
def
|
|
87
|
-
|
|
88
|
-
|
|
31
|
+
def self.find_all_by_flag(flag_name)
|
|
32
|
+
get_from("/flags/#{flag_name}/assets", :account_id => account_id)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def tags
|
|
36
|
+
Base.get_from("/assets/#{id}/tags")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.count
|
|
40
|
+
Base.get_from("/assets/count")["count"]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.find(id)
|
|
44
|
+
data = get_from("/assets/#{id}")
|
|
45
|
+
return nil if data[:status].eql?('invalid asset id')
|
|
46
|
+
new(data)
|
|
89
47
|
end
|
|
90
48
|
|
|
91
|
-
def
|
|
92
|
-
|
|
49
|
+
def preset_xml
|
|
50
|
+
Base.get_from("/assets/#{id}/preset_xml")["preset_xml"]
|
|
93
51
|
end
|
|
94
|
-
|
|
52
|
+
|
|
95
53
|
def deactivate
|
|
96
|
-
|
|
54
|
+
Base.post_to("/assets/#{id}/deactivate")["status"]
|
|
97
55
|
end
|
|
98
|
-
|
|
56
|
+
|
|
99
57
|
def activate
|
|
100
|
-
|
|
58
|
+
Base.post_to("/assets/#{id}/activate")["status"]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def destroy
|
|
62
|
+
Base.delete_from("/assets/#{id}")["status"]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def save(attributes={})
|
|
66
|
+
Base.put_to("/assets/#{id}", :asset => {:name => name, :password => password, :description => description}.merge(attributes))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def add_category(name)
|
|
70
|
+
Category.new(Base.post_to("/assets/#{id}/categories", :category => {:name => name}))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def remove_category
|
|
74
|
+
category = self.category
|
|
75
|
+
return true if category.nil?
|
|
76
|
+
Base.delete_from("/assets/#{id}/categories/#{category.id}")
|
|
101
77
|
end
|
|
102
78
|
|
|
103
|
-
def
|
|
104
|
-
data =
|
|
79
|
+
def category
|
|
80
|
+
data = Base.get_from("/assets/#{id}/categories")
|
|
81
|
+
return nil if data["result"] == 'failure'
|
|
82
|
+
Category.new(data)
|
|
105
83
|
end
|
|
106
84
|
|
|
107
|
-
def
|
|
108
|
-
|
|
85
|
+
def embed_codes
|
|
86
|
+
Base.get_from("/assets/#{id}/embed_codes")['embed_codes']
|
|
109
87
|
end
|
|
110
|
-
|
|
111
|
-
def
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
88
|
+
|
|
89
|
+
def add_tags(tags)
|
|
90
|
+
Base.post_to("/assets/#{id}/tags", { :tag_list => tags })
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def flags
|
|
94
|
+
Base.get_from("/assets/#{id}/flags")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def add_flags(flags)
|
|
98
|
+
Base.post_to("/assets/#{id}/flags", {:flag_list => flags})
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def delete_metadata(key)
|
|
102
|
+
Base.delete_from("/assets/#{id}/metadata/#{key}")[:status]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def get_metadata_value(key)
|
|
106
|
+
data = Base.get_from("/assets/#{id}/metadata/#{key}")
|
|
107
|
+
return nil if data["status"] == 404
|
|
108
|
+
data["result"]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def set_metadata(key, value)
|
|
112
|
+
data = Base.post_to("/assets/#{id}/metadata", {:key => key, :value => value})
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def metadata
|
|
116
|
+
Base.get_from("/assets/#{id}/metadata")
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def group
|
|
120
|
+
return nil if @group_id.nil?
|
|
121
|
+
Group.new(Base.get_from("/groups/#{group_id}")['group'])
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def add_group(group)
|
|
125
|
+
data = Base.put_to("/groups/#{group.id}/assets/#{id}")
|
|
126
|
+
if data['status'].eql?('Success')
|
|
127
|
+
@group_id = group.id
|
|
115
128
|
else
|
|
116
|
-
data
|
|
129
|
+
data['status']
|
|
117
130
|
end
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
data
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
private
|
|
127
|
-
def get_embed_codes
|
|
128
|
-
data = post_to("/api/getAllEmbedcodes?vguid=#{id}&sessionId=#{account.sessionId}")
|
|
129
|
-
|
|
130
|
-
if data['embedList']
|
|
131
|
-
data['embedList'].each do |embed|
|
|
132
|
-
embed =~ /width="(\d+)"/
|
|
133
|
-
width = $1
|
|
134
|
-
|
|
135
|
-
embed =~ /height="(\d+)"/
|
|
136
|
-
height = $1
|
|
137
|
-
|
|
138
|
-
ratio = (width.to_f / height.to_f)
|
|
139
|
-
|
|
140
|
-
aspect = (ratio <= 1.33 ? 'Full Screen' : 'Widescreen')
|
|
141
|
-
|
|
142
|
-
self.embedList["#{width}x#{height} - #{aspect}"] = embed
|
|
143
|
-
|
|
144
|
-
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def streaming_server_and_video_path
|
|
134
|
+
data = Base.get_from("/videos/#{id}/streaming_url")
|
|
135
|
+
if data['status'].eql?("not found")
|
|
136
|
+
nil
|
|
137
|
+
else
|
|
138
|
+
data
|
|
145
139
|
end
|
|
146
|
-
|
|
147
|
-
self.defaultEmbed = data['defaultEmbed']
|
|
148
140
|
end
|
|
149
141
|
|
|
142
|
+
def initialize(data)
|
|
143
|
+
@encode_date = data['encode_date']
|
|
144
|
+
@frame_rate = data['frame_rate']
|
|
145
|
+
@height = data['height']
|
|
146
|
+
@date_last_modified = data['date_last_modified']
|
|
147
|
+
@video_bitrate_mode = data['video_bitrate_mode']
|
|
148
|
+
@media_type = data['media_type']
|
|
149
|
+
@id = data['id']
|
|
150
|
+
@account_id = data['account_id']
|
|
151
|
+
@number_of_views = data['number_of_views']
|
|
152
|
+
@application = data['application']
|
|
153
|
+
@audio_codec = data['audio_codec']
|
|
154
|
+
@permalink_location = data['permalink_location']
|
|
155
|
+
@status = data['status']
|
|
156
|
+
@description = data['description']
|
|
157
|
+
@video_duration = data['video_duration']
|
|
158
|
+
@abstract_file_id = data['abstract_file_id']
|
|
159
|
+
@version_id = data['version_id']
|
|
160
|
+
@date_retrieved = data['date_retrieved']
|
|
161
|
+
@audio_data_rate = data['audio_data_rate']
|
|
162
|
+
@audio_bitrate_mode = data['audio_bitrate_mode']
|
|
163
|
+
@video_codec = data['video_codec']
|
|
164
|
+
@display_name = data['display_name']
|
|
165
|
+
@name = data['name']
|
|
166
|
+
@video_data_rate = data['video_data_rate']
|
|
167
|
+
@author_id = data['author_id']
|
|
168
|
+
@width = data['width']
|
|
169
|
+
@file_size = data['file_size']
|
|
170
|
+
@thumbnail_image_url = data['thumbnail_image_url']
|
|
171
|
+
@direct_asset_url = data['direct_asset_url']
|
|
172
|
+
@group_id = data['group_id']
|
|
173
|
+
@embed_list = data['embed_list']
|
|
174
|
+
@video_guid = @embed_list.empty? ? nil : @embed_list.to_a.first[1].match(/videoGUID=(.*?)&/)[1]
|
|
175
|
+
end
|
|
150
176
|
end
|
|
151
177
|
end
|
|
152
178
|
end
|
data/three_sixty.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{three_sixty}
|
|
5
|
-
s.version = "1.0.
|
|
5
|
+
s.version = "1.0.1"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Sorenson Media"]
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.description = %q{Ruby bindings for Sorenson 360 Backend}
|
|
11
11
|
s.email = %q{video@sorensonmedia.com}
|
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "README", "lib/sorenson/threesixty.rb", "lib/sorenson/threesixty/account.rb", "lib/sorenson/threesixty/account_summary.rb", "lib/sorenson/threesixty/asset.rb", "lib/sorenson/threesixty/asset_metrics.rb", "lib/sorenson/threesixty/base.rb", "lib/sorenson/threesixty/format_constraint.rb", "lib/sorenson/threesixty/rate_plan.rb", "lib/sorenson/threesixty/subaccount.rb", "lib/sorenson/threesixty/uploader.rb", "tasks/rspec.rake"]
|
|
13
|
-
s.files = ["CHANGELOG", "README", "Rakefile", "lib/sorenson/threesixty.rb", "lib/sorenson/threesixty/account.rb", "lib/sorenson/threesixty/account_summary.rb", "lib/sorenson/threesixty/asset.rb", "lib/sorenson/threesixty/asset_metrics.rb", "lib/sorenson/threesixty/base.rb", "lib/sorenson/threesixty/format_constraint.rb", "lib/sorenson/threesixty/rate_plan.rb", "lib/sorenson/threesixty/subaccount.rb", "lib/sorenson/threesixty/uploader.rb", "spec/account_spec.rb", "spec/account_summary_spec.rb", "spec/asset_metrics_spec.rb", "spec/asset_spec.rb", "spec/base_spec.rb", "spec/format_constraint_spec.rb", "spec/rate_plan_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/uploader_spec.rb", "tasks/rspec.rake", "
|
|
13
|
+
s.files = ["CHANGELOG", "HOW_TO_BUILD.txt", "Manifest", "README", "Rakefile", "lib/sorenson/threesixty.rb", "lib/sorenson/threesixty/account.rb", "lib/sorenson/threesixty/account_summary.rb", "lib/sorenson/threesixty/asset.rb", "lib/sorenson/threesixty/asset_metrics.rb", "lib/sorenson/threesixty/base.rb", "lib/sorenson/threesixty/format_constraint.rb", "lib/sorenson/threesixty/rate_plan.rb", "lib/sorenson/threesixty/subaccount.rb", "lib/sorenson/threesixty/uploader.rb", "spec/account_spec.rb", "spec/account_summary_spec.rb", "spec/asset_metrics_spec.rb", "spec/asset_spec.rb", "spec/base_spec.rb", "spec/format_constraint_spec.rb", "spec/rate_plan_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/uploader_spec.rb", "tasks/rspec.rake", "three_sixty.gemspec"]
|
|
14
14
|
s.homepage = %q{https://github.com/sorenson/ThreeSixtyServices-Internal}
|
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Three_sixty", "--main", "README"]
|
|
16
16
|
s.require_paths = ["lib"]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: three_sixty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sorenson Media
|
|
@@ -54,6 +54,8 @@ extra_rdoc_files:
|
|
|
54
54
|
- tasks/rspec.rake
|
|
55
55
|
files:
|
|
56
56
|
- CHANGELOG
|
|
57
|
+
- HOW_TO_BUILD.txt
|
|
58
|
+
- Manifest
|
|
57
59
|
- README
|
|
58
60
|
- Rakefile
|
|
59
61
|
- lib/sorenson/threesixty.rb
|
|
@@ -77,7 +79,6 @@ files:
|
|
|
77
79
|
- spec/spec_helper.rb
|
|
78
80
|
- spec/uploader_spec.rb
|
|
79
81
|
- tasks/rspec.rake
|
|
80
|
-
- Manifest
|
|
81
82
|
- three_sixty.gemspec
|
|
82
83
|
has_rdoc: true
|
|
83
84
|
homepage: https://github.com/sorenson/ThreeSixtyServices-Internal
|