360_services 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/360_services.gemspec +5 -5
- data/Manifest +2 -0
- data/Rakefile +3 -3
- data/lib/sorenson/services/account.rb +12 -2
- data/lib/sorenson/services/preset.rb +21 -0
- data/lib/sorenson/services/subaccount.rb +32 -0
- data/lib/sorenson/services.rb +3 -1
- metadata +7 -3
data/360_services.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{360_services}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.5"
|
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"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-03-09}
|
10
10
|
s.description = %q{Ruby bindings for Sorenson 360}
|
11
11
|
s.email = %q{video@sorensonmedia.com}
|
12
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/sorenson/services.rb", "lib/sorenson/services/account.rb", "lib/sorenson/services/array.rb", "lib/sorenson/services/asset.rb", "lib/sorenson/services/base.rb", "lib/sorenson/services/category.rb", "lib/sorenson/services/core_ext.rb", "lib/sorenson/services/core_ext/attribute_accessors.rb", "lib/sorenson/services/core_ext/hash.rb", "lib/sorenson/services/core_ext/object.rb", "lib/sorenson/services/event.rb", "lib/sorenson/services/flag.rb", "lib/sorenson/services/group.rb", "lib/sorenson/services/metric.rb", "lib/sorenson/services/rate_plan.rb", "lib/sorenson/services/site.rb", "lib/sorenson/services/tag.rb"]
|
13
|
-
s.files = ["HOW_TO_BUILD.txt", "Manifest", "README.rdoc", "Rakefile", "features/manage_accounts.feature", "features/manage_assets.feature", "features/manage_categories.feature", "features/manage_flags.feature", "features/manage_group_assets.feature", "features/manage_groups.feature", "features/manage_metadata.feature", "features/manage_metrics.feature", "features/manage_sites.feature", "features/manage_tags.feature", "features/mange_rate_plan.feature", "features/step_definitions/manage_accounts_steps.rb", "features/step_definitions/manage_assets_steps.rb", "features/step_definitions/manage_categories_steps.rb", "features/step_definitions/manage_flags_steps.rb", "features/step_definitions/manage_group_assets_steps.rb", "features/step_definitions/manage_groups_steps.rb", "features/step_definitions/manage_metadata_steps.rb", "features/step_definitions/manage_metrics_steps.rb", "features/step_definitions/manage_sites_steps.rb", "features/step_definitions/manage_tags_steps.rb", "features/step_definitions/mange_rate_plan_steps.rb", "features/step_definitions/utility_steps.rb", "features/step_definitions/web_steps.rb", "features/support/document_steps.rb", "features/support/env.rb", "features/support/netrecorder.rb", "features/support/paths.rb", "lib/sorenson/services.rb", "lib/sorenson/services/account.rb", "lib/sorenson/services/array.rb", "lib/sorenson/services/asset.rb", "lib/sorenson/services/base.rb", "lib/sorenson/services/category.rb", "lib/sorenson/services/core_ext.rb", "lib/sorenson/services/core_ext/attribute_accessors.rb", "lib/sorenson/services/core_ext/hash.rb", "lib/sorenson/services/core_ext/object.rb", "lib/sorenson/services/event.rb", "lib/sorenson/services/flag.rb", "lib/sorenson/services/group.rb", "lib/sorenson/services/metric.rb", "lib/sorenson/services/rate_plan.rb", "lib/sorenson/services/site.rb", "lib/sorenson/services/tag.rb", "360_services.gemspec"]
|
14
|
-
s.homepage = %q{http://github.com/
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/sorenson/services.rb", "lib/sorenson/services/account.rb", "lib/sorenson/services/array.rb", "lib/sorenson/services/asset.rb", "lib/sorenson/services/base.rb", "lib/sorenson/services/category.rb", "lib/sorenson/services/core_ext.rb", "lib/sorenson/services/core_ext/attribute_accessors.rb", "lib/sorenson/services/core_ext/hash.rb", "lib/sorenson/services/core_ext/object.rb", "lib/sorenson/services/event.rb", "lib/sorenson/services/flag.rb", "lib/sorenson/services/group.rb", "lib/sorenson/services/metric.rb", "lib/sorenson/services/preset.rb", "lib/sorenson/services/rate_plan.rb", "lib/sorenson/services/site.rb", "lib/sorenson/services/subaccount.rb", "lib/sorenson/services/tag.rb"]
|
13
|
+
s.files = ["HOW_TO_BUILD.txt", "Manifest", "README.rdoc", "Rakefile", "features/manage_accounts.feature", "features/manage_assets.feature", "features/manage_categories.feature", "features/manage_flags.feature", "features/manage_group_assets.feature", "features/manage_groups.feature", "features/manage_metadata.feature", "features/manage_metrics.feature", "features/manage_sites.feature", "features/manage_tags.feature", "features/mange_rate_plan.feature", "features/step_definitions/manage_accounts_steps.rb", "features/step_definitions/manage_assets_steps.rb", "features/step_definitions/manage_categories_steps.rb", "features/step_definitions/manage_flags_steps.rb", "features/step_definitions/manage_group_assets_steps.rb", "features/step_definitions/manage_groups_steps.rb", "features/step_definitions/manage_metadata_steps.rb", "features/step_definitions/manage_metrics_steps.rb", "features/step_definitions/manage_sites_steps.rb", "features/step_definitions/manage_tags_steps.rb", "features/step_definitions/mange_rate_plan_steps.rb", "features/step_definitions/utility_steps.rb", "features/step_definitions/web_steps.rb", "features/support/document_steps.rb", "features/support/env.rb", "features/support/netrecorder.rb", "features/support/paths.rb", "lib/sorenson/services.rb", "lib/sorenson/services/account.rb", "lib/sorenson/services/array.rb", "lib/sorenson/services/asset.rb", "lib/sorenson/services/base.rb", "lib/sorenson/services/category.rb", "lib/sorenson/services/core_ext.rb", "lib/sorenson/services/core_ext/attribute_accessors.rb", "lib/sorenson/services/core_ext/hash.rb", "lib/sorenson/services/core_ext/object.rb", "lib/sorenson/services/event.rb", "lib/sorenson/services/flag.rb", "lib/sorenson/services/group.rb", "lib/sorenson/services/metric.rb", "lib/sorenson/services/preset.rb", "lib/sorenson/services/rate_plan.rb", "lib/sorenson/services/site.rb", "lib/sorenson/services/subaccount.rb", "lib/sorenson/services/tag.rb", "360_services.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/sorenson/360_services}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "360_services", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{360_services}
|
data/Manifest
CHANGED
@@ -44,6 +44,8 @@ lib/sorenson/services/event.rb
|
|
44
44
|
lib/sorenson/services/flag.rb
|
45
45
|
lib/sorenson/services/group.rb
|
46
46
|
lib/sorenson/services/metric.rb
|
47
|
+
lib/sorenson/services/preset.rb
|
47
48
|
lib/sorenson/services/rate_plan.rb
|
48
49
|
lib/sorenson/services/site.rb
|
50
|
+
lib/sorenson/services/subaccount.rb
|
49
51
|
lib/sorenson/services/tag.rb
|
data/Rakefile
CHANGED
@@ -3,9 +3,9 @@ require 'cucumber'
|
|
3
3
|
require 'cucumber/rake/task'
|
4
4
|
require 'echoe'
|
5
5
|
|
6
|
-
Echoe.new('360_services', '0.0.
|
6
|
+
Echoe.new('360_services', '0.0.5') do |p|
|
7
7
|
p.description = "Ruby bindings for Sorenson 360"
|
8
|
-
p.url = "http://github.com/
|
8
|
+
p.url = "http://github.com/sorenson/360_services"
|
9
9
|
p.author = "Sorenson Media"
|
10
10
|
p.email = "video@sorensonmedia.com"
|
11
11
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
@@ -27,4 +27,4 @@ namespace :cucumber do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
task :default => :cucumber
|
30
|
-
task :cucumber => 'cucumber:ok'
|
30
|
+
task :cucumber => 'cucumber:ok'
|
@@ -2,11 +2,12 @@ module Sorenson
|
|
2
2
|
module Services
|
3
3
|
class Account < Base
|
4
4
|
attr_accessor :rate_plan, :username, :status, :customer_id, :id, :rate_plan_expiration_date, :date_last_modified,
|
5
|
-
:last_login_time, :date_retrieved, :total_asset_count, :token
|
5
|
+
:last_login_time, :date_retrieved, :total_asset_count, :token, :subaccount_id
|
6
6
|
cattr_accessor :account_token, :account_id
|
7
7
|
|
8
8
|
def self.login(username, password)
|
9
|
-
|
9
|
+
data = JSON.parse(login_no_resource(username, password))
|
10
|
+
account = Account.new(data)
|
10
11
|
self.account_token = account.token
|
11
12
|
self.account_id = account.id
|
12
13
|
return account if account.token
|
@@ -33,11 +34,20 @@ module Sorenson
|
|
33
34
|
Base.post_to("/accounts/#{account_id}/empty_trash")['status']
|
34
35
|
end
|
35
36
|
|
37
|
+
def get_subaccounts
|
38
|
+
get_from("/subaccounts")
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_subaccount(username, email, password)
|
42
|
+
Base.post_to("/subaccounts", :subaccount => {:username => username, :email => email, :password => password})
|
43
|
+
end
|
44
|
+
|
36
45
|
def initialize(data)
|
37
46
|
self.username = data['username']
|
38
47
|
self.status = data['status']
|
39
48
|
self.customer_id = data['id']
|
40
49
|
self.id = data['id']
|
50
|
+
self.subaccount_id = data['subaccountId']
|
41
51
|
self.rate_plan_expiration_date = data['rate_plan_expiration_date']
|
42
52
|
self.date_last_modified = data['date_last_modified']
|
43
53
|
self.last_login_time = data['last_login_time']
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Sorenson Namespace
|
2
|
+
module Sorenson
|
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.
|
6
|
+
class Preset < Base
|
7
|
+
def self.all
|
8
|
+
get_from('/presets')
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.find_by_name(name)
|
12
|
+
response = get_from("/presets/#{URI.encode(name)}")
|
13
|
+
if response.has_key?(:errors)
|
14
|
+
nil
|
15
|
+
else
|
16
|
+
response['url']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Sorenson
|
2
|
+
module Services
|
3
|
+
class Subaccount < Base
|
4
|
+
|
5
|
+
# Attributes
|
6
|
+
attr_accessor :account, :id, :username, :status, :accountId, :email, :dateRetrieved
|
7
|
+
|
8
|
+
# Class Methods
|
9
|
+
|
10
|
+
# Instance Methods
|
11
|
+
|
12
|
+
def initialize(account, data)
|
13
|
+
self.account = account
|
14
|
+
self.username = data['username']
|
15
|
+
self.id = data['id']
|
16
|
+
self.status = data['status']
|
17
|
+
self.accountId = data['accountId']
|
18
|
+
self.email = data['email']
|
19
|
+
self.dateRetrieved = data['dateRetrieved']
|
20
|
+
end
|
21
|
+
|
22
|
+
def activate!
|
23
|
+
Base.put_to("/subaccounts/#{id}/activate")
|
24
|
+
end
|
25
|
+
|
26
|
+
def deactivate!
|
27
|
+
Base.put_to("/subaccounts/#{id}/deactivate")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/sorenson/services.rb
CHANGED
@@ -15,4 +15,6 @@ require(File.join(File.dirname(__FILE__), 'services', 'account'))
|
|
15
15
|
require(File.join(File.dirname(__FILE__), 'services', 'asset'))
|
16
16
|
require(File.join(File.dirname(__FILE__), 'services', 'array'))
|
17
17
|
require(File.join(File.dirname(__FILE__), 'services', 'site'))
|
18
|
-
require(File.join(File.dirname(__FILE__), 'services', '
|
18
|
+
require(File.join(File.dirname(__FILE__), 'services', 'subaccount'))
|
19
|
+
require(File.join(File.dirname(__FILE__), 'services', 'core_ext', 'object'))
|
20
|
+
require(File.join(File.dirname(__FILE__), 'services', 'preset'))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 360_services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sorenson Media
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -74,8 +74,10 @@ extra_rdoc_files:
|
|
74
74
|
- lib/sorenson/services/flag.rb
|
75
75
|
- lib/sorenson/services/group.rb
|
76
76
|
- lib/sorenson/services/metric.rb
|
77
|
+
- lib/sorenson/services/preset.rb
|
77
78
|
- lib/sorenson/services/rate_plan.rb
|
78
79
|
- lib/sorenson/services/site.rb
|
80
|
+
- lib/sorenson/services/subaccount.rb
|
79
81
|
- lib/sorenson/services/tag.rb
|
80
82
|
files:
|
81
83
|
- HOW_TO_BUILD.txt
|
@@ -124,12 +126,14 @@ files:
|
|
124
126
|
- lib/sorenson/services/flag.rb
|
125
127
|
- lib/sorenson/services/group.rb
|
126
128
|
- lib/sorenson/services/metric.rb
|
129
|
+
- lib/sorenson/services/preset.rb
|
127
130
|
- lib/sorenson/services/rate_plan.rb
|
128
131
|
- lib/sorenson/services/site.rb
|
132
|
+
- lib/sorenson/services/subaccount.rb
|
129
133
|
- lib/sorenson/services/tag.rb
|
130
134
|
- 360_services.gemspec
|
131
135
|
has_rdoc: true
|
132
|
-
homepage: http://github.com/
|
136
|
+
homepage: http://github.com/sorenson/360_services
|
133
137
|
licenses: []
|
134
138
|
|
135
139
|
post_install_message:
|