360_services 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.
@@ -6,20 +6,30 @@ Feature: Manage Assets
6
6
  Scenario: Get a list of asset guids by passing a tag name
7
7
  Given I am logged in
8
8
  And I get all assets
9
- Then the assets list should contain "e036f43c-2a9f-407f-bc26-19af2b89d222"
9
+ # Then the assets list should contain a asset with a id of "e036f43c-2a9f-407f-bc26-19af2b89d222"
10
+
11
+ Scenario: Save an asset
12
+ Given I am logged in
13
+ And I get the asset with id "e036f43c-2a9f-407f-bc26-19af2b89d222"
14
+ When I change the asset attribute "description" to "new description"
15
+ And I save the asset
16
+ And I reload the asset
17
+ Then the asset's description should be "new description"
18
+ Then I change the asset attribute "description" to "description"
19
+ And I save the asset
10
20
 
11
21
  Scenario: Get asset
12
22
  Given I am logged in
13
- And I get the first asset
14
- Then the asset attribute "name" should be "capture-4851742166757112347.mp4"
23
+ And I get the asset with id "e036f43c-2a9f-407f-bc26-19af2b89d222"
24
+ Then the asset attribute "name" should be "test.mp4"
15
25
 
16
26
  Scenario: Get asset count
17
27
  Given I am logged in
18
- Then the asset count should be "14"
28
+ Then the asset count should be "67"
19
29
 
20
30
  Scenario: Get asset presets
21
31
  Given I am logged in
22
- And I get the first asset
32
+ And I get the asset with id "e036f43c-2a9f-407f-bc26-19af2b89d222"
23
33
  Then the preset xml should contain "MP4-squish-007.xss"
24
34
 
25
35
  Scenario: Activate and Deactivate
@@ -30,7 +40,7 @@ Scenario: Activate and Deactivate
30
40
  Then the assets list should not contain the asset id
31
41
  When I activate the asset
32
42
  And I get all assets
33
- Then the assets list should contain the asset id
43
+ Then the assets list should contain a asset with a id of "e036f43c-2a9f-407f-bc26-19af2b89d222"
34
44
 
35
45
  Scenario: Delete an asset
36
46
  Given I am logged in
@@ -40,19 +50,11 @@ Scenario: Delete an asset
40
50
  Then the assets list should not contain the asset id
41
51
  When I undelete the asset
42
52
  And I get all assets
43
- Then the assets list should contain the asset id
53
+ Then the assets list should contain a asset with a id of "e036f43c-2a9f-407f-bc26-19af2b89d222"
44
54
 
45
- Scenario: Save an asset
46
- Given I am logged in
47
- And I get the first asset
48
- When I change the asset attribute "description" to "new description"
49
- And I save the asset
50
- And I reload the asset
51
- Then the asset attribute "description" should be "new description"
52
- Then I change the asset attribute "description" to "description"
53
- And I save the asset
55
+
54
56
 
55
57
  Scenario: Get asset embed codes
56
58
  Given I am logged in
57
- And I get the first asset
59
+ And I get the asset with id "e036f43c-2a9f-407f-bc26-19af2b89d222"
58
60
  Then the asset embed codes should contain "flash_media_loader.swf"
@@ -19,7 +19,7 @@ Scenario: List flagged assets
19
19
 
20
20
  Scenario: Count flags
21
21
  Given I am logged in
22
- Then the flag count should be 4
22
+ Then the flag count should be "4"
23
23
 
24
24
  Scenario: Add flags to asset
25
25
  Given I am logged in
@@ -34,7 +34,7 @@ Scenario: Find all assets by flag
34
34
  And I get the first asset
35
35
  And I assign the flag "red" to the asset
36
36
  And I find all assets with the flag "red"
37
- Then the assets list should contain "c67f1fdb-8199-4b5c-921f-d864cf2d903f"
37
+ Then the assets list should contain "a5ef53eb-032e-4983-9828-ee72ee6c6bc2"
38
38
 
39
39
  Scenario: Get asset flags
40
40
  Given I am logged in
@@ -10,7 +10,7 @@ Background:
10
10
 
11
11
  Scenario: Create a group
12
12
  When I create a group named "my group"
13
- Then the group attribute "name" should be "my group"
13
+ Then the group's name should be "my group"
14
14
 
15
15
  Scenario: Find a group by id
16
16
  When I create a group named "my group"
@@ -19,7 +19,7 @@ Scenario: Find a group by id
19
19
  Scenario: Get all groups
20
20
  And I create a group named "my group"
21
21
  And I get all groups
22
- Then the groups list should contain the group id
22
+ Then the group list should contain the group
23
23
 
24
24
  Scenario: Delete a group
25
25
  When I create a group named "delete me"
@@ -5,11 +5,11 @@ Feature: Manage Metrics
5
5
 
6
6
  Scenario: See Total Plays
7
7
  Given I am logged in
8
- Then the total plays should be "12"
8
+ Then the total plays should be "39"
9
9
 
10
10
  Scenario: See Storage Used
11
11
  Given I am logged in
12
- Then the storage used should be "-12290471.0"
12
+ Then the storage used should be "42581251.0"
13
13
 
14
14
  Scenario: See all metrics
15
15
  Given I am logged in
@@ -13,5 +13,5 @@ Scenario: Get a site by name
13
13
  Given I am logged in
14
14
  When I create a new site with the name "new site name" and the description "new site description"
15
15
  And I get the site named "new site name"
16
- Then the site attribute "id" should be "b4b866a0-d7d8-012c-1ba4-00254b9d9628"
16
+ Then the site attribute "id" should be "b8453bf0-fe23-012c-3e4c-0026bb5241fa"
17
17
 
@@ -27,7 +27,7 @@ Scenario: Get asset tags
27
27
 
28
28
  Scenario: Get tag count
29
29
  Given I am logged in
30
- Then the tag count should be "7"
30
+ Then the tag count should be "4"
31
31
 
32
32
  Scenario: Get all tags
33
33
  Given I am logged in
@@ -7,10 +7,18 @@ And /^I get the asset with id "([^\"]*)"$/ do |arg1|
7
7
  end
8
8
 
9
9
  And "I get the first asset" do
10
- @asset = Sorenson::Services::Asset.find(Sorenson::Services::Asset.all.first)
10
+ @asset = Sorenson::Services::Asset.find(Sorenson::Services::Asset.all.first.id)
11
11
  @asset.should_not be_nil
12
12
  end
13
13
 
14
+ Then /^the asset's description should be "(.*)"/ do |value|
15
+ @asset.description.should == value
16
+ end
17
+
18
+ Then /the assets list should contain a asset with a id of "(.*)"/ do |guid|
19
+ @assets.map(&:id).include?(guid)
20
+ end
21
+
14
22
  Then /^the asset count should be "([^\"]*)"$/ do |arg1|
15
23
  Sorenson::Services::Asset.count.should == arg1.to_i
16
24
  end
@@ -2,7 +2,7 @@ When /^I get all flags$/ do
2
2
  @flags = Sorenson::Services::Flag.all
3
3
  end
4
4
 
5
- Then /^the flag count should be ([^\"]*)$/ do |count|
5
+ Then /^the flag count should be "(.*)"$/ do |count|
6
6
  Sorenson::Services::Flag.count.should == count.to_i
7
7
  end
8
8
 
@@ -3,13 +3,13 @@ When /^I add the asset to the group$/ do
3
3
  end
4
4
 
5
5
  Then /^the asset should be in the group$/ do
6
- @group.assets.should include(@asset.id)
6
+ @group.assets.map(&:id).should include(@asset.id)
7
7
  end
8
8
 
9
9
  Then /^the asset should have the group$/ do
10
- @asset.groups.should include(@group.id)
10
+ @asset.group.should == @group
11
11
  end
12
12
 
13
13
  Then /^the group should have the asset$/ do
14
- @group.assets.should include(@asset.id) # express the regexp above with the code you wish you had
14
+ @group.assets.map(&:id).should include(@asset.id)
15
15
  end
@@ -11,7 +11,11 @@ When /^I reload the group$/ do
11
11
  end
12
12
 
13
13
  Then /^I should be able to find the group$/ do
14
- @group = Sorenson::Services::Group.find(Sorenson::Services::Group.all.first)
14
+ @group = Sorenson::Services::Group.find(@group.id)
15
+ end
16
+
17
+ Then /^the group's name should be "(.*)"/ do |name|
18
+ @group.name.should == name
15
19
  end
16
20
 
17
21
  And /^I get all groups$/ do
@@ -19,9 +23,13 @@ And /^I get all groups$/ do
19
23
  end
20
24
 
21
25
  Then /^I delete the group if it was found$/ do
22
- @group.destroy if @group
26
+ @group.delete if @group
23
27
  end
24
28
 
25
29
  Then /^I delete the group$/ do
26
- @group.destroy
30
+ @group.delete
31
+ end
32
+
33
+ Then /^the group list should contain the group$/ do
34
+ @groups.include?(@group)
27
35
  end
@@ -1,4 +1,4 @@
1
- ENV['SORENSON_ENV'] = "cucumber"
1
+ ENV['RAILS_ENV'] = "cucumber"
2
2
  require 'rubygems'
3
3
  require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
4
4
  require 'webrat'
@@ -10,4 +10,4 @@ require "#{File.dirname(__FILE__)}/../../lib/sorenson/services.rb"
10
10
  Webrat.configure do |config|
11
11
  config.mode = :rails
12
12
  config.open_error_files = false # Set to true if you want error pages to pop up in the browser
13
- end
13
+ end
@@ -3,6 +3,7 @@ module Sorenson
3
3
  class Account < Base
4
4
  attr_accessor :rate_plan, :username, :status, :customer_id, :id, :rate_plan_expiration_date, :date_last_modified,
5
5
  :last_login_time, :date_retrieved, :total_asset_count, :token
6
+ cattr_accessor :account_token, :account_id
6
7
 
7
8
  def self.login(username, password)
8
9
  account = Account.new(JSON.parse(login_no_resource(username, password)))
@@ -11,7 +11,7 @@ module Sorenson
11
11
  :permalink_location, :status, :description, :video_duration, :abstract_file_id, :version_id,
12
12
  :date_retrieved, :audio_data_rate, :audio_bitrate_mode, :video_codec, :display_name, :name,
13
13
  :video_data_rate, :author_id, :width, :file_size, :thumbnail_image_url, :direct_asset_url,
14
- :password, :metadata, :groups
14
+ :password, :metadata, :groups, :embed_list
15
15
 
16
16
  # Get all of the assets as a list of guids. Use offset and quantity to return subsets.
17
17
  # Sorenson::Services::Account.login('username', 'password')
@@ -19,7 +19,8 @@ module Sorenson
19
19
  # names = assets.collect {|asset| asset.name}
20
20
  # => names = ["name1", "name2"]
21
21
  def self.all(offset = nil, quantity = nil)
22
- get_from("/assets", :offset => offset, :quantity => quantity)["asset_list"]
22
+ list = get_from("/assets", :offset => offset, :quantity => quantity)["asset_list"]
23
+ list.collect {|a| new(a) }
23
24
  end
24
25
 
25
26
  # Get a list of asset guids by passing a tag name
@@ -40,7 +41,7 @@ module Sorenson
40
41
  end
41
42
 
42
43
  def self.find(id)
43
- new(get_from("/assets/#{id}"), id)
44
+ new(get_from("/assets/#{id}"))
44
45
  end
45
46
 
46
47
  def preset_xml
@@ -113,17 +114,17 @@ module Sorenson
113
114
  end
114
115
 
115
116
  def group
116
- Group.new(Base.get_from("/groups/#{@group_id}")) if group_id
117
- end
118
-
119
- def initialize(data, id)
117
+ Group.new(Base.get_from("/groups/#{@group_id}")) if @group_id
118
+ end
119
+
120
+ def initialize(data)
120
121
  @encode_date = data['encode_date']
121
122
  @frame_rate = data['frame_rate']
122
123
  @height = data['height']
123
124
  @date_last_modified = data['date_last_modified']
124
125
  @video_bitrate_mode = data['video_bitrate_mode']
125
126
  @media_type = data['media_type']
126
- @id = data['account_id']
127
+ @id = data['id']
127
128
  @account_id = data['account_id']
128
129
  @number_of_views = data['number_of_views']
129
130
  @application = data['application']
@@ -146,9 +147,8 @@ module Sorenson
146
147
  @file_size = data['file_size']
147
148
  @thumbnail_image_url = data['thumbnail_image_url']
148
149
  @direct_asset_url = data['direct_asset_url']
149
- @groups = data['groups']
150
- @id = id
151
- @metadata = id
150
+ @group_id = data['group_id']
151
+ @embed_list = data['embed_list']
152
152
  end
153
153
  end
154
154
  end
@@ -18,12 +18,12 @@ module Sorenson
18
18
  end
19
19
  end
20
20
 
21
- def self.login_no_resource(username, password)
21
+ def self.login_no_resource(username, password)
22
22
  RestClient.post(host + "/sessions", :username => username, :password => password)
23
23
  end
24
24
 
25
25
  def self.host
26
- host = ENV['SORENSON_ENV'].eql?('cucumber') ? 'http://localhost:3001' : 'http://360services.sorensonmedia.com'
26
+ host = ['development', 'test', 'cucumber'].include?(ENV['RAILS_ENV']) ? 'http://localhost:3001' : 'http://360services.sorensonmedia.com'
27
27
  host
28
28
  end
29
29
 
@@ -2,6 +2,7 @@ module Sorenson
2
2
  module Services
3
3
  class Category < Base
4
4
  attr_accessor :description, :name, :parent_id, :parent, :id
5
+
5
6
  def self.all
6
7
  get_from("/categories").map{|c| c["name"]}
7
8
  end
@@ -1,40 +1,56 @@
1
1
  module Sorenson
2
2
  module Services
3
3
  class Group < Base
4
- attr_accessor :name, :description, :account_id, :id, :assets
4
+ attr_accessor :name, :description, :account_id, :id, :guid
5
5
 
6
6
  def self.create(name, attributes={})
7
- new(post_to("/groups", :group => attributes.merge(:name => name)))
8
- end
9
-
10
- def add_asset(asset)
11
- self.assets = Base.put_to("/groups/#{id}/assets/#{asset.id}")
7
+ data = post_to("/groups", :group => attributes.merge(:name => name))
8
+ new(data['group'])
12
9
  end
13
10
 
14
11
  def self.all
15
- Base.get_from("/groups")
12
+ collection = Base.get_from("/groups")
13
+ collection.collect { |data| new(data['group'])}
16
14
  end
17
15
 
18
16
  def self.find(id)
19
17
  data = Base.get_from("/groups/#{id}")
20
- new(data) if data['group']
18
+ return new(data['group']) if data['group']
19
+ nil
21
20
  end
22
21
 
23
22
  def self.find_by_name(name)
24
23
  data = Base.get_from("/groups/find_by_name", :name => name)
25
- new(data) if data['group']
24
+ return new(data['group']) if data['group']
25
+ nil
26
+ end
27
+
28
+ def add_asset(asset)
29
+ Base.put_to("/groups/#{id}/assets/#{asset.id}")
30
+ end
31
+
32
+ def add_user(user_id)
33
+ Base.put_to("/groups/#{id}/users/#{user_id}")
34
+ end
35
+
36
+ def assets
37
+ collection = Base.get_from("/groups/#{id}/assets")
38
+ collection.collect { |data| Sorenson::Services::Asset.new(data) }
39
+ end
40
+
41
+ def users
42
+ Base.get_from("/groups/#{id}/users")
26
43
  end
27
44
 
28
- def destroy
45
+ def delete
29
46
  Base.delete_from("/groups/#{id}")
30
47
  end
31
48
 
32
49
  def initialize(attributes)
33
- @name = attributes['group']["name"]
34
- @description = attributes['group']["description"]
35
- @account_id = attributes['group']["account_id"]
36
- @id = attributes['group']["guid"]
37
- @assets = attributes['group']["asset_ids"]
50
+ @name = attributes["name"]
51
+ @description = attributes["description"]
52
+ @account_id = attributes["account_id"]
53
+ @id = attributes["guid"]
38
54
  end
39
55
  end
40
56
  end
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.1
4
+ version: 0.0.2
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-01-25 00:00:00 -07:00
12
+ date: 2010-02-23 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
 
61
61
  extra_rdoc_files:
62
+ - README.rdoc
62
63
  - lib/sorenson/services.rb
63
64
  - lib/sorenson/services/account.rb
64
65
  - lib/sorenson/services/array.rb
@@ -78,6 +79,7 @@ extra_rdoc_files:
78
79
  - lib/sorenson/services/tag.rb
79
80
  files:
80
81
  - Manifest
82
+ - README.rdoc
81
83
  - Rakefile
82
84
  - fakeweb_cache
83
85
  - features/manage_accounts.feature
@@ -136,6 +138,8 @@ rdoc_options:
136
138
  - --inline-source
137
139
  - --title
138
140
  - 360_services
141
+ - --main
142
+ - README.rdoc
139
143
  require_paths:
140
144
  - lib
141
145
  required_ruby_version: !ruby/object:Gem::Requirement