360_services 1.0.5 → 1.0.6

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/360_services.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{360_services}
5
- s.version = "1.0.5"
5
+ s.version = "1.0.6"
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-03-16}
9
+ s.date = %q{2010-03-17}
10
10
  s.description = %q{Ruby bindings for Sorenson 360}
11
11
  s.email = %q{video@sorensonmedia.com}
12
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"]
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'cucumber/rake/task'
4
4
  require 'echoe'
5
5
 
6
6
 
7
- Echoe.new('360_services', '1.0.5') do |p|
7
+ Echoe.new('360_services', '1.0.6') do |p|
8
8
  p.description = "Ruby bindings for Sorenson 360"
9
9
  p.url = "http://github.com/sorenson/360_services"
10
10
  p.author = "Sorenson Media"
@@ -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, :embed_list, :group_id
14
+ :password, :metadata, :embed_list, :group_id
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')
@@ -41,7 +41,9 @@ module Sorenson
41
41
  end
42
42
 
43
43
  def self.find(id)
44
- new(get_from("/assets/#{id}"))
44
+ data = get_from("/assets/#{id}")
45
+ return nil if data[:status].eql?('invalid asset id')
46
+ new(data)
45
47
  end
46
48
 
47
49
  def preset_xml
@@ -119,6 +121,13 @@ module Sorenson
119
121
  Group.new(Base.get_from("/groups/#{group_id}")['group'])
120
122
  end
121
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
128
+ end
129
+ end
130
+
122
131
  def initialize(data)
123
132
  @encode_date = data['encode_date']
124
133
  @frame_rate = data['frame_rate']
@@ -61,7 +61,12 @@ module Sorenson
61
61
 
62
62
  def self.parse_response(response)
63
63
  begin
64
- JSON.parse(response.body)
64
+ data = JSON.parse(response.body)
65
+ if data.is_a?(Hash)
66
+ HashWithIndifferentAccess.new.merge(data)
67
+ else
68
+ data
69
+ end
65
70
  rescue JSON::ParserError => e
66
71
  raise InvalidServerResponse.new("Sorenson::Services::InvalidServerResponse: #{e.message}")
67
72
  end
@@ -37,6 +37,8 @@ module Sorenson
37
37
  end
38
38
 
39
39
  def add_asset(asset)
40
+ # If you have an Asset it memory, using this method does not update the assets state
41
+ # You would need to "Re"-find the asset to get the update to date state
40
42
  Base.put_to("/groups/#{id}/assets/#{asset.id}")
41
43
  end
42
44
 
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: 1.0.5
4
+ version: 1.0.6
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-03-16 00:00:00 -07:00
12
+ date: 2010-03-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency