encoding-dot-com 0.0.2 → 0.0.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{encoding-dot-com}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roland Swingler", "Alan Kennedy", "Levent Ali"]
12
- s.date = %q{2009-12-08}
12
+ s.date = %q{2009-12-17}
13
13
  s.description = %q{A ruby wrapper for the encoding.com API}
14
14
  s.email = %q{roland.swingler@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -23,7 +23,8 @@ module EncodingDotCom
23
23
  # various formats. Item will be processed after being added.
24
24
  #
25
25
  # +source+:: the source url
26
- # +formats+:: a hash of destination urls => format objects
26
+ # +formats+:: a hash of destination urls => format objects/format
27
+ # attribute hashes
27
28
  def add_and_process(source, formats={})
28
29
  add_request("AddMedia", source, formats)
29
30
  end
@@ -32,7 +33,8 @@ module EncodingDotCom
32
33
  # various formats.
33
34
  #
34
35
  # +source+:: the source url
35
- # +formats+:: a hash of destination urls => format objects
36
+ # +formats+:: a hash of destination urls => format objects/format
37
+ # attribute hashes
36
38
  def add(source, formats={})
37
39
  add_request("AddMediaBenchmark", source, formats)
38
40
  end
@@ -93,7 +95,10 @@ module EncodingDotCom
93
95
  def add_request(action, source, formats)
94
96
  response = make_request(action) do |q|
95
97
  q.source source
96
- formats.each {|url, format| format.build_xml(q, url) }
98
+ formats.each do |url, format|
99
+ format_builder = (format.kind_of?(Format)) ? format : Format.create(format)
100
+ format_builder.build_xml(q, url)
101
+ end
97
102
  end
98
103
  media_id = response.xpath("/response/MediaID").text
99
104
  media_id.to_i if media_id
data/spec/queue_spec.rb CHANGED
@@ -85,6 +85,11 @@ describe "Encoding.com Queue facade" do
85
85
  expect_response_xml("<response><MediaID>1234</MediaID></response>")
86
86
  @facade.add_and_process(stub("source"), {}).should == 1234
87
87
  end
88
+
89
+ it "should accept formats as a hash of format attributes" do
90
+ expect_xml_with_xpath("/query/format/output[text()='flv']")
91
+ @facade.add_and_process(stub("source"), "http://example.com" => {"output" => "flv"})
92
+ end
88
93
  end
89
94
 
90
95
  describe "xml sent to encoding.com to get the status of a job" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encoding-dot-com
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roland Swingler
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-12-08 00:00:00 +00:00
14
+ date: 2009-12-17 00:00:00 +00:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency