moovatom 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +3 -1
  2. data/README.md +183 -35
  3. data/Rakefile +17 -0
  4. data/lib/moovatom/version.rb +1 -1
  5. data/lib/moovatom.rb +5 -11
  6. data/moovatom.gemspec +6 -1
  7. data/spec/fixtures/cancel.xml +4 -0
  8. data/spec/fixtures/detail.xml +57 -0
  9. data/spec/fixtures/encode.xml +4 -0
  10. data/spec/fixtures/status_error.xml +6 -0
  11. data/spec/fixtures/status_success.xml +6 -0
  12. data/spec/request_spec.rb +73 -0
  13. data/spec/spec_helper.rb +9 -0
  14. metadata +52 -40
  15. data/doc/Gemfile.html +0 -94
  16. data/doc/LICENSE_txt.html +0 -110
  17. data/doc/MoovAtom/MoovEngine.html +0 -604
  18. data/doc/MoovAtom.html +0 -168
  19. data/doc/Rakefile.html +0 -92
  20. data/doc/created.rid +0 -7
  21. data/doc/images/brick.png +0 -0
  22. data/doc/images/brick_link.png +0 -0
  23. data/doc/images/bug.png +0 -0
  24. data/doc/images/bullet_black.png +0 -0
  25. data/doc/images/bullet_toggle_minus.png +0 -0
  26. data/doc/images/bullet_toggle_plus.png +0 -0
  27. data/doc/images/date.png +0 -0
  28. data/doc/images/find.png +0 -0
  29. data/doc/images/loadingAnimation.gif +0 -0
  30. data/doc/images/macFFBgHack.png +0 -0
  31. data/doc/images/package.png +0 -0
  32. data/doc/images/page_green.png +0 -0
  33. data/doc/images/page_white_text.png +0 -0
  34. data/doc/images/page_white_width.png +0 -0
  35. data/doc/images/plugin.png +0 -0
  36. data/doc/images/ruby.png +0 -0
  37. data/doc/images/tag_green.png +0 -0
  38. data/doc/images/wrench.png +0 -0
  39. data/doc/images/wrench_orange.png +0 -0
  40. data/doc/images/zoom.png +0 -0
  41. data/doc/index.html +0 -72
  42. data/doc/init_rb.html +0 -54
  43. data/doc/js/darkfish.js +0 -116
  44. data/doc/js/jquery.js +0 -32
  45. data/doc/js/quicksearch.js +0 -114
  46. data/doc/js/thickbox-compressed.js +0 -10
  47. data/doc/lib/moovatom/version_rb.html +0 -52
  48. data/doc/lib/moovatom_rb.html +0 -70
  49. data/doc/rdoc.css +0 -763
data/.gitignore CHANGED
@@ -2,4 +2,6 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
-
5
+ notes.txt
6
+ .rvmrc
7
+ doc/*
data/README.md CHANGED
@@ -1,41 +1,43 @@
1
1
  Introduction
2
2
  ============
3
3
 
4
- [MoovAtom](http://moovatom.com/ "MoovAtom Homepage") is an online video conversion and streaming service. The service insulates your videos from competitor's ads or links to inappropriate content. It offers customizable players that support hot linkable watermarks in addition to stream paths to your own player so you can control your videos, and your brand, on your own terms. Streaming is supported to all Apple mobile devices as well as most Android and Blackberry platforms. A unique QR Code is generated for each video for use in advertisements, allowing your viewers to simply "scan and play" your content. Advanced analytics and metrics provide valuable incite into how your viewers are watching you videos. The MoovAtom servers support both FTP access and direct uploads so huge file sizes are easy to handle. MoovAtom makes it easy to protect your copyrights, the streaming servers provide unparalleled protection over other services using progressive downloads to a user's browser cache.
4
+ [MoovAtom](http://moovatom.com/) is an online video conversion and streaming service. The service insulates your videos from competitor's ads or links to inappropriate content. It offers customizable players that support hot linkable watermarks in addition to stream paths to your own player so you can control your videos, and your brand, on your own terms. Streaming is supported to all Apple mobile devices as well as most Android and Blackberry platforms. A unique QR Code is generated for each video for use in advertisements, allowing your viewers to simply "scan and play" your content. Advanced analytics and metrics provide valuable incite into how your viewers are watching your videos. The MoovAtom servers support both FTP access and direct uploads so huge file sizes are easy to handle. MoovAtom makes it easy to protect your copyrights, the streaming servers provide unparalleled protection over other services using progressive downloads to a user's browser cache.
5
5
 
6
6
 
7
7
  API
8
8
  ===
9
9
 
10
- [MoovEngine](http://www.moovatom.com/support/api/1.0 "MoovEngine API") is the API interface to MoovAtom's servers and your video content. This library has been written to provide an easier interface for Ruby and Rails developers. The MoovAtom API utilizes a RESTful XML implementation. Simple XML requests are posted to MoovAtom's servers and XML responses are returned containing the various details about and status of your videos.
10
+ [MoovEngine](http://www.moovatom.com/support/api/1.0) is the API interface to MoovAtom's servers and your video content. This library has been written to provide an easier interface for Ruby and Rails developers. The MoovAtom API utilizes a RESTful XML implementation. Simple XML requests are posted to MoovAtom's servers and XML responses are returned containing the various details about and status of your videos.
11
11
 
12
12
 
13
13
  Overview
14
14
  ========
15
15
  This library is wrapped in a module named MoovAtom. Inside the module there is a single class named MoovEngine. So to instantiate a new object to communicate with the MoovAtom API you simply need to call:
16
16
 
17
- <code>
18
- require 'moovatom'
19
- new_conn = MoovAtom::MoovEngine.new
20
- </code>
17
+ ```
18
+ require 'moovatom'
19
+ new_conn = MoovAtom::MoovEngine.new
20
+ ```
21
21
 
22
22
  Of course you can also simplify that code by using:
23
23
 
24
- <code>
25
- require 'moovatom'
26
- include MoovAtom
27
- new_conn = MoovEngine.new
28
- </code>
24
+ ```
25
+ require 'moovatom'
26
+ include MoovAtom
27
+ new_conn = MoovEngine.new
28
+ ```
29
29
 
30
30
  This code allows you to create a new instance without needing to enter the module's scope each time.
31
31
 
32
- Installing the gem is as simple as `gem install moovatom`. However, this library is in an extreme alpha state so it may be best to access the gem via this GitHub repo. You can include a gem from its GitHub by adding the following to your app's Gemfile:
32
+ Installing the gem is as simple as `gem install moovatom`.
33
33
 
34
- <code>
35
- gem 'moovatom', :git => "git://github.com/humanshell/moovatom.git"
36
- </code>
34
+ Or by adding the following line to your project's Gemfile:
37
35
 
38
- There is a single module constant named `API_URL` that defines the URL to which the XML requests must be POST'd to. There are eight writable instance variables and one readable variable. The single readable variable is `@xml_response`. It's function is to hold the last response received from MoovAtom's servers. The other variables are as follows:
36
+ ```
37
+ gem "moovatom", "~>0.1.2"
38
+ ```
39
+
40
+ There is a single module constant named `API_URL` that defines the URL to which the XML requests must be POST'd. There are eight writable instance variables and one readable variable. The single readable variable is `@xml_response`. It's responsible for holding the last response received from MoovAtom's servers. The other variables are as follows:
39
41
 
40
42
  1. `@guid`
41
43
  2. `@username`
@@ -48,40 +50,186 @@ There is a single module constant named `API_URL` that defines the URL to which
48
50
 
49
51
  These variables are used to communicate details about your account and your videos to MoovAtom's servers. You can define and pass them to the initialize method or set them after an object has been created with the usual accessor 'dot' notation:
50
52
 
51
- <code>
52
- require 'moovatom'
53
- include MoovAtom
54
- args = { :title => "My Super Video", :sourcefile => "http://example.com/supervideo.mp4", etc... }
55
- new_conn = MoovEngine.new args
56
- </code>
53
+ ```
54
+ require 'moovatom'
55
+ include MoovAtom
56
+ args = { title: "My Super Video", sourcefile: "http://example.com/supervideo.mp4", etc... }
57
+ new_conn = MoovEngine.new args
58
+ ```
57
59
 
58
60
  Or...
59
61
 
60
- <code>
61
- require 'moovatom'
62
- include MoovAtom
63
- new_conn = MoovEngine.new
64
- new_conn.title = "My Super Video"
65
- new_conn.sourcefile = "http://example.com/supervideo.mp4"
66
- </code>
67
-
62
+ ```
63
+ require 'moovatom'
64
+ include MoovAtom
65
+ new_conn = MoovEngine.new
66
+ new_conn.title = "My Super Video"
67
+ new_conn.sourcefile = "http://example.com/supervideo.mp4"
68
+ ```
68
69
 
69
70
  Encoding
70
71
  ========
71
- Coming soon...
72
+ To start a new encoding on Moovatom's servers you need to create a `MoovAtom::MoovEngine` object populated with the following information:
73
+
74
+ ```
75
+ new_conn = MoovAtom::MoovEngine.new
72
76
 
77
+ new_conn.username = "MOOVATOM_USERNAME"
78
+ new_conn.userkey = "MOOVATOM_USERKEY"
79
+ new_conn.title = "The Greatest Movie Ever"
80
+ new_conn.blurb = "The gratest movie ever made!"
81
+ new_conn.sourcefile = "http://example.com/greatest_movie_ever.mp4"
82
+ new_conn.callbackurl = "/moovatom_callback"
83
+
84
+ response = new_conn.encode
85
+ ```
86
+
87
+ The video you want to submit to Moovatom must be placed in a publicly accessible location. You should map the callback url to a controller that stores the uuid returned by the Moovatom servers into your database. You can use that uuid in the remaining request methods to access that specific encoding. Future versions of the gem will accept a block when instantiating a MoovEngine object.
73
88
 
74
89
  Status
75
90
  ======
76
- Coming soon...
91
+ To retrieve the status of an existing encoding on Moovatom's servers you need a `MoovAtom::MoovEngine` object populated with the following information:
92
+
93
+ ```
94
+ new_conn = MoovAtom::MoovEngine.new
95
+
96
+ new_conn.username = "MOOVATOM_USERNAME"
97
+ new_conn.userkey = "MOOVATOM_USERKEY"
98
+ new_conn.uuid = "UUID_OF_VIDEO"
99
+
100
+ response = new_conn.status
101
+ ```
102
+
103
+ The Moovatom servers will respond one of two ways:
104
+
105
+ Success:
106
+
107
+ ```
108
+ <?xml version="1.0"?>
109
+ <response>
110
+ <uuid>UUID</uuid>
111
+ <processing>True</processing>
112
+ <percent_complete>75</percent_complete>
113
+ <error></error>
114
+ </response>
115
+ ```
77
116
 
117
+ Error:
118
+
119
+ ```
120
+ <?xml version="1.0"?>
121
+ <response>
122
+ <uuid>UUID</uuid>
123
+ <processing>False</processing>
124
+ <percent_complete>100</percent_complete>
125
+ <error>This was not a recognized format.</error>
126
+ </response>
127
+ ```
78
128
 
79
129
  Details
80
130
  =======
81
- Coming soon...
82
-
131
+ When you need to get the details about an encoding that has finished on Moovatom's server you need a `MoovAtom::MoovEngine` object populated with the following information:
132
+
133
+ ```
134
+ new_conn = MoovAtom::MoovEngine.new
135
+
136
+ new_conn.username = "MOOVATOM_USERNAME"
137
+ new_conn.userkey = "MOOVATOM_USERKEY"
138
+ new_conn.uuid = "UUID_OF_VIDEO"
139
+
140
+ response = new_conn.details
141
+ ```
142
+
143
+ The response from a request for details contains the same information returned to the `@callbackurl` when an encoding completes:
144
+
145
+ ```
146
+ <?xml version="1.0"?>
147
+ <response>
148
+ <uuid>UUID</uuid>
149
+ <media_type>video</media_type>
150
+ <embed_code>EMBED CODE IFRAME FOR SMART SWITCHING</embed_code>
151
+ <iframe_target>http://www.moovatom.com/media/embed/SHORTID</iframe_target>
152
+ <original_download>http://www.moovatom.com/media/download/orig/UUID</original_download>
153
+ <versions>
154
+ <version>
155
+ <name>mobile</name>
156
+ <type>video/mp4</type>
157
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
158
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
159
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
160
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
161
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
162
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
163
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
164
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
165
+ </version>
166
+ <version>
167
+ <name>small</name>
168
+ <type>video/mp4</type>
169
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
170
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
171
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
172
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
173
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
174
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
175
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
176
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
177
+ </version>
178
+ <version>
179
+ <name>medium</name>
180
+ <type>video/mp4</type>
181
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
182
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
183
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
184
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
185
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
186
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
187
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
188
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
189
+ </version>
190
+ <version>
191
+ <name>large</name>
192
+ <type>video/mp4</type>
193
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
194
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
195
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
196
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
197
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
198
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
199
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
200
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
201
+ </version>
202
+ </versions>
203
+ </response>
204
+ ```
83
205
 
84
206
  Cancel
85
207
  ======
86
- Coming soon...
208
+ To cancel an unfinished encoding on Moovatom's servers you need a `MoovAtom::MoovEngine` object populated with the following information:
209
+
210
+ ```
211
+ new_conn = MoovAtom::MoovEngine.new
212
+
213
+ new_conn.username = "MOOVATOM_USERNAME"
214
+ new_conn.userkey = "MOOVATOM_USERKEY"
215
+ new_conn.uuid = "UUID_OF_VIDEO"
216
+
217
+ response = new_conn.cancel
218
+ ```
219
+
220
+ A successful cancellation results in the following response:
221
+
222
+ ```
223
+ <?xml version="1.0"?>
224
+ <response>
225
+ <uuid>UUID</uuid>
226
+ <message>This job was successfully cancelled.</message>
227
+ </response>
228
+ ```
229
+
230
+ For more specific instructions on using the Moovatom API please check the [documentation](http://www.moovatom.com/support/requests.html)
231
+
232
+ Testing
233
+ =======
234
+ This gem uses [Minitest](https://github.com/seattlerb/minitest), [Turn](https://github.com/TwP/turn) and [Fakeweb](https://github.com/chrisk/fakeweb) to implement specs for each of the above four request methods.
87
235
 
data/Rakefile CHANGED
@@ -1 +1,18 @@
1
1
  require 'bundler/gem_tasks'
2
+ require "bundler/version"
3
+ require 'rake/testtask'
4
+
5
+ task :default => :minitest
6
+
7
+ Rake::TestTask.new(:minitest) do |t|
8
+ t.libs << 'spec'
9
+ t.test_files = FileList['spec/*_spec.rb']
10
+ end
11
+
12
+ task :build do
13
+ system "gem build moovatom.gemspec"
14
+ end
15
+
16
+ task :release => :build do
17
+ system "gem push moovatom-#{MoovAtom::VERSION}"
18
+ end
@@ -1,3 +1,3 @@
1
1
  module MoovAtom
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/moovatom.rb CHANGED
@@ -38,7 +38,7 @@ module MoovAtom
38
38
  # * etc...
39
39
  #
40
40
  # Or:
41
- # * args = { :username => 'YOUR_USERNAME', :userkey => 'YOUR_USERKEY', etc... }
41
+ # * args = { username: 'YOUR_USERNAME', userkey: 'YOUR_USERKEY', etc... }
42
42
  # * moov_engine = MoovAtom::MoovEngine.new(args)
43
43
  def initialize(args={})
44
44
  @guid = args[:guid]
@@ -54,9 +54,7 @@ module MoovAtom
54
54
  # Use this method to get the details about a video that's finished encoding.
55
55
  # This method requires @username, @userkey and @guid to be set.
56
56
  #
57
- # If @guid has not yet been set then you can pass it in the hash argument.
58
- #
59
- # @TODO add the ability to yield to a block
57
+ # If @guid has not yet been set then you can pass it in as a string argument.
60
58
  #
61
59
  # Usage:
62
60
  # * moov_engine.details
@@ -70,9 +68,7 @@ module MoovAtom
70
68
  # Use this method to get the status of a video that is currently being encoded.
71
69
  # This method requires @username, @userkey and @guid to be set.
72
70
  #
73
- # If @guid has not yet been set then you can pass it in the hash argument.
74
- #
75
- # @TODO add the ability to yield to a block
71
+ # If @guid has not yet been set then you can pass it in as a string argument.
76
72
  #
77
73
  # Usage:
78
74
  # * moov_engine.status
@@ -93,10 +89,8 @@ module MoovAtom
93
89
  # * @sourcefile
94
90
  # * @callbackurl
95
91
  #
96
- # @TODO this method <b>REALLY</b> needs to be able to yield to a block!
97
- #
98
92
  # Usage:
99
- # * moov_engine.status 'GUID_OF_VIDEO'
93
+ # * moov_engine.details
100
94
  def encode
101
95
  @action = 'encode'
102
96
  @xml_response = send_xml_request(build_xml_request)
@@ -110,7 +104,7 @@ module MoovAtom
110
104
  # Use this method to cancel the encoding of a video.
111
105
  # This method requires @username, @userkey and @guid to be set.
112
106
  #
113
- # If @guid has not yet been set then you can pass it in the hash argument.
107
+ # If @guid has not yet been set then you can pass it in as a string argument.
114
108
  #
115
109
  # Usage:
116
110
  # * moov_engine.cancel
data/moovatom.gemspec CHANGED
@@ -20,7 +20,12 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- #-- dependency info
23
+ #-- release dependencies
24
24
  s.add_dependency('builder')
25
+
26
+ #-- development dependencies
27
+ s.add_development_dependency('minitest')
28
+ s.add_development_dependency('turn')
29
+ s.add_development_dependency('fakeweb')
25
30
 
26
31
  end
@@ -0,0 +1,4 @@
1
+ <response>
2
+ <uuid>456</uuid>
3
+ <message>This job was successfully cancelled.</message>
4
+ </response>
@@ -0,0 +1,57 @@
1
+ <response>
2
+ <uuid>456</uuid>
3
+ <media_type>video</media_type>
4
+ <embed_code>EMBED CODE IFRAME FOR SMART SWITCHING</embed_code>
5
+ <iframe_target>http://www.moovatom.com/media/embed/SHORTID</iframe_target>
6
+ <original_download>http://www.moovatom.com/media/download/orig/UUID</original_download>
7
+ <versions>
8
+ <version>
9
+ <name>mobile</name>
10
+ <type>video/mp4</type>
11
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
12
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
13
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
14
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
15
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
16
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
17
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
18
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
19
+ </version>
20
+ <version>
21
+ <name>small</name>
22
+ <type>video/mp4</type>
23
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
24
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
25
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
26
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
27
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
28
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
29
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
30
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
31
+ </version>
32
+ <version>
33
+ <name>medium</name>
34
+ <type>video/mp4</type>
35
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
36
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
37
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
38
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
39
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
40
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
41
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
42
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
43
+ </version>
44
+ <version>
45
+ <name>large</name>
46
+ <type>video/mp4</type>
47
+ <holdframe_download>http://www.moovatom.com/PATH_TO_FILE</holdframe_download>
48
+ <thumbnail_download>http://www.moovatom.com/PATH_TO_FILE</thumbnail_download>
49
+ <holdframe_serve>http://static.moovatom.com/PATH_TO_FILE</holdframe_serve>
50
+ <thumbnail_serve>http://static.moovatom.com/PATH_TO_FILE</thumbnail_serve>
51
+ <rtmp_stream>rtmp://media.moovatom.com/PATH_TO_FILE</rtmp_stream>
52
+ <http_stream>http://media.moovatom.com:1935/PATH_TO_FILE</http_stream>
53
+ <rtsp_stream>rtsp://media.moovatom.com:1935/PATH_TO_FILE</rtsp_stream>
54
+ <download>http://www.moovatom.com/PATH_TO_FILE</download>
55
+ </version>
56
+ </versions>
57
+ </response>
@@ -0,0 +1,4 @@
1
+ <response>
2
+ <uuid>456</uuid>
3
+ <message>Your job was started successfully.</message>
4
+ </response>
@@ -0,0 +1,6 @@
1
+ <response>
2
+ <uuid>456</uuid>
3
+ <processing>False</processing>
4
+ <percent_complete>100</percent_complete>
5
+ <error>This was not a recognized format.</error>
6
+ </response>
@@ -0,0 +1,6 @@
1
+ <response>
2
+ <uuid>456</uuid>
3
+ <processing>True</processing>
4
+ <percent_complete>75</percent_complete>
5
+ <error></error>
6
+ </response>
@@ -0,0 +1,73 @@
1
+ require "spec_helper"
2
+
3
+ describe MoovAtom::MoovEngine do
4
+ before do
5
+ @args = {
6
+ username: 'jsmith',
7
+ userkey: '123',
8
+ guid: '456',
9
+ title: 'Test Video Title',
10
+ blurb: 'A Short description about the video.',
11
+ sourcefile: 'http://example.com/path/to/file/test.mp4',
12
+ callbackurl: 'http://example.com/job_complete'
13
+ }
14
+
15
+ @moov_engine = MoovAtom::MoovEngine.new @args
16
+ end
17
+
18
+ after do
19
+ FakeWeb.clean_registry
20
+ end
21
+
22
+ describe "Details request..." do
23
+ it "gets the details of an existing video" do
24
+ xml = File.join(File.dirname(__FILE__), 'fixtures', 'detail.xml')
25
+ FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
26
+ xml_res = @moov_engine.details
27
+ xml_res.body.must_include "<uuid>456</uuid>"
28
+ xml_res.body.must_include "<versions>"
29
+ end
30
+ end
31
+
32
+ describe "Status request success..." do
33
+ it "handles a successful status request" do
34
+ xml = File.join(File.dirname(__FILE__), 'fixtures', 'status_success.xml')
35
+ FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
36
+ xml_res = @moov_engine.status
37
+ xml_res.body.must_include "<uuid>456</uuid>"
38
+ xml_res.body.must_include "<processing>True</processing>"
39
+ xml_res.body.must_include "<error></error>"
40
+ end
41
+ end
42
+
43
+ describe "Status request error..." do
44
+ it "handles an unsuccessful status request" do
45
+ xml = File.join(File.dirname(__FILE__), 'fixtures', 'status_error.xml')
46
+ FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
47
+ xml_res = @moov_engine.status
48
+ xml_res.body.must_include "<uuid>456</uuid>"
49
+ xml_res.body.must_include "<processing>False</processing>"
50
+ xml_res.body.must_include "<error>This was not a recognized format.</error>"
51
+ end
52
+ end
53
+
54
+ describe "Encode request..." do
55
+ it "starts encoding a new video" do
56
+ xml = File.join(File.dirname(__FILE__), 'fixtures', 'encode.xml')
57
+ FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
58
+ xml_res = @moov_engine.encode
59
+ xml_res.must_equal "456"
60
+ end
61
+ end
62
+
63
+ describe "Cancel request..." do
64
+ it "cancels the encoding of an existing video" do
65
+ xml = File.join(File.dirname(__FILE__), 'fixtures', 'cancel.xml')
66
+ FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
67
+ xml_res = @moov_engine.cancel
68
+ xml_res.body.must_include "<uuid>456</uuid>"
69
+ xml_res.body.must_include "<message>This job was successfully cancelled.</message>"
70
+ end
71
+ end
72
+ end
73
+
@@ -0,0 +1,9 @@
1
+ gem "minitest"
2
+ require "minitest/autorun"
3
+ require "turn"
4
+ require "fakeweb"
5
+ require "moovatom"
6
+
7
+ # disable all real requests while in testing mode
8
+ FakeWeb.allow_net_connect = false
9
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moovatom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-10 00:00:00.000000000Z
12
+ date: 2012-01-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
16
- requirement: &70309525469680 !ruby/object:Gem::Requirement
16
+ requirement: &70261003001300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,40 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70309525469680
24
+ version_requirements: *70261003001300
25
+ - !ruby/object:Gem::Dependency
26
+ name: minitest
27
+ requirement: &70261003000880 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70261003000880
36
+ - !ruby/object:Gem::Dependency
37
+ name: turn
38
+ requirement: &70261003000460 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70261003000460
47
+ - !ruby/object:Gem::Dependency
48
+ name: fakeweb
49
+ requirement: &70261003000040 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70261003000040
25
58
  description: This gem defines methods for controlling your videos on MoovAtom using
26
59
  the MoovEngine API.
27
60
  email:
@@ -35,45 +68,17 @@ files:
35
68
  - LICENSE.txt
36
69
  - README.md
37
70
  - Rakefile
38
- - doc/Gemfile.html
39
- - doc/LICENSE_txt.html
40
- - doc/MoovAtom.html
41
- - doc/MoovAtom/MoovEngine.html
42
- - doc/Rakefile.html
43
- - doc/created.rid
44
- - doc/images/brick.png
45
- - doc/images/brick_link.png
46
- - doc/images/bug.png
47
- - doc/images/bullet_black.png
48
- - doc/images/bullet_toggle_minus.png
49
- - doc/images/bullet_toggle_plus.png
50
- - doc/images/date.png
51
- - doc/images/find.png
52
- - doc/images/loadingAnimation.gif
53
- - doc/images/macFFBgHack.png
54
- - doc/images/package.png
55
- - doc/images/page_green.png
56
- - doc/images/page_white_text.png
57
- - doc/images/page_white_width.png
58
- - doc/images/plugin.png
59
- - doc/images/ruby.png
60
- - doc/images/tag_green.png
61
- - doc/images/wrench.png
62
- - doc/images/wrench_orange.png
63
- - doc/images/zoom.png
64
- - doc/index.html
65
- - doc/init_rb.html
66
- - doc/js/darkfish.js
67
- - doc/js/jquery.js
68
- - doc/js/quicksearch.js
69
- - doc/js/thickbox-compressed.js
70
- - doc/lib/moovatom/version_rb.html
71
- - doc/lib/moovatom_rb.html
72
- - doc/rdoc.css
73
71
  - init.rb
74
72
  - lib/moovatom.rb
75
73
  - lib/moovatom/version.rb
76
74
  - moovatom.gemspec
75
+ - spec/fixtures/cancel.xml
76
+ - spec/fixtures/detail.xml
77
+ - spec/fixtures/encode.xml
78
+ - spec/fixtures/status_error.xml
79
+ - spec/fixtures/status_success.xml
80
+ - spec/request_spec.rb
81
+ - spec/spec_helper.rb
77
82
  homepage: http://moovatom.com
78
83
  licenses: []
79
84
  post_install_message:
@@ -98,4 +103,11 @@ rubygems_version: 1.8.10
98
103
  signing_key:
99
104
  specification_version: 3
100
105
  summary: Access MoovAtom API
101
- test_files: []
106
+ test_files:
107
+ - spec/fixtures/cancel.xml
108
+ - spec/fixtures/detail.xml
109
+ - spec/fixtures/encode.xml
110
+ - spec/fixtures/status_error.xml
111
+ - spec/fixtures/status_success.xml
112
+ - spec/request_spec.rb
113
+ - spec/spec_helper.rb