diff --git a/README.rdoc b/README.rdoc index 15b5725..bef940f 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,6 +1,37 @@ = encoding-dot-com -Description goes here. +A client library for the encoding.com API. + +Supports all the actions of the encoding.com API. Example usage: + + require "encoding_dot_com" + + # Create an interface to the encoding.com queue with your user id and secret + queue = EncodingDotCom::Queue.new(1234, "secret") + + # Create one or more output formats + format = EncodingDotCom::Format.create("output" => "flv") + + # Get an media item processed. You can pass multiple output formats in a hash. + media_id = queue.add_and_process("http://source/url/here", "http://destination/url/here" => format) + + queue.status(media_id) # => returns a string like "Waiting for encoder" or "Finished" + queue.info(media_id) # => returns information about an item in the queue + +See the API documentation for more details. + +By default the library uses Curb for http - there is also a Net/HTTP +adapter and it is easy to write your own. + +== Dependencies + +* Nokogiri +* (Optionally) curb + +== TODOs + +* Flesh out validations to ensure that bad data does not get submitted to + encoding.com == Note on Patches/Pull Requests @@ -13,6 +44,12 @@ Description goes here. bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. +== Authors + +* Roland Swingler +* Alan Kennedy +* Levent Ali + == Copyright Copyright (c) 2009 Enrich Social Productions Ltd. See LICENSE for details. diff --git a/lib/encoding-dot-com.rb b/lib/encoding-dot-com.rb index afdf07c..ce062ca 100644 --- a/lib/encoding-dot-com.rb +++ b/lib/encoding-dot-com.rb @@ -1,5 +1,5 @@ require 'encoding_dot_com/errors' -require 'encoding_dot_com/facade' +require 'encoding_dot_com/queue' require 'encoding_dot_com/attribute_restrictions' require 'encoding_dot_com/format' require 'encoding_dot_com/video_format' diff --git a/lib/encoding_dot_com.rb b/lib/encoding_dot_com.rb new file mode 100644 index 0000000..f46edc9 --- /dev/null +++ b/lib/encoding_dot_com.rb @@ -0,0 +1,2 @@ +require 'encoding-dot-com' + diff --git a/lib/encoding_dot_com/facade.rb b/lib/encoding_dot_com/queue.rb similarity index 99% rename from lib/encoding_dot_com/facade.rb rename to lib/encoding_dot_com/queue.rb index 56e8665..35069e6 100644 --- a/lib/encoding_dot_com/facade.rb +++ b/lib/encoding_dot_com/queue.rb @@ -4,7 +4,7 @@ module EncodingDotCom # A remote facade to the encoding.com API. # # The facade is stateless and can be reused for multiple requests. - class Facade + class Queue # Where encoding.com expects messages to be posted to. ENDPOINT = "http://manage.encoding.com/" diff --git a/spec/facade_spec.rb b/spec/queue_spec.rb similarity index 98% rename from spec/facade_spec.rb rename to spec/queue_spec.rb index fa0c30f..160c070 100644 --- a/spec/facade_spec.rb +++ b/spec/queue_spec.rb @@ -1,14 +1,14 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') -describe "Encoding.com Facade" do +describe "Encoding.com Queue facade" do before :each do @http = mock("Http Interface") - @facade = EncodingDotCom::Facade.new(1234, "abcd", @http) + @facade = EncodingDotCom::Queue.new(1234, "abcd", @http) end def expect_xml_with_xpath(xpath) - @http.should_receive(:post).with(EncodingDotCom::Facade::ENDPOINT, + @http.should_receive(:post).with(EncodingDotCom::Queue::ENDPOINT, EncodingXpathMatcher.new(xpath)).and_return(stub("Http Response", :code => "200", :body => "")) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2c5ff12..f5e89a2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,7 +5,6 @@ require 'spec' require 'spec/autorun' require 'nokogiri' -require 'encoding_dot_com/facade' class EncodingXpathMatcher def initialize(xpath)