moovatom 0.1.0
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/.gitignore +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +7 -0
- data/README.md +87 -0
- data/Rakefile +1 -0
- data/doc/Gemfile.html +94 -0
- data/doc/LICENSE_txt.html +110 -0
- data/doc/MoovAtom/MoovEngine.html +587 -0
- data/doc/MoovAtom.html +168 -0
- data/doc/Rakefile.html +92 -0
- data/doc/created.rid +7 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +72 -0
- data/doc/init_rb.html +54 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/lib/moovatom/version_rb.html +52 -0
- data/doc/lib/moovatom_rb.html +70 -0
- data/doc/rdoc.css +763 -0
- data/init.rb +1 -0
- data/lib/moovatom/version.rb +3 -0
- data/lib/moovatom.rb +146 -0
- data/moovatom.gemspec +26 -0
- metadata +101 -0
data/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'moovatom'
|
data/lib/moovatom.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
# :title: MoovAtom API Documentation
|
2
|
+
# The MoovEngine API provides the RESTful interface for encoding, canceling and querying,
|
3
|
+
# your videos on the MoovAtom servers. This library defines the methods and functionality
|
4
|
+
# necessary for your app to communicate with that interface.
|
5
|
+
#
|
6
|
+
# See README file for installation details and general usage information.
|
7
|
+
#
|
8
|
+
# Author:: Dominic Giglio <mailto:humanshell@gmail.com>
|
9
|
+
# Copyright:: Copyright (c) 2011 Dominic Giglio - All Rights Reserved
|
10
|
+
# License:: MIT
|
11
|
+
|
12
|
+
#-- required gems/libraries
|
13
|
+
%w[net/https rexml/document builder uri].each { |item| require item }
|
14
|
+
|
15
|
+
#-- wrap the whole library in a module to enforce namespace
|
16
|
+
module MoovAtom
|
17
|
+
|
18
|
+
#-- MoovAtom module constants
|
19
|
+
API_URL = 'https://moovatom.com/api/api_request'
|
20
|
+
|
21
|
+
class MoovEngine
|
22
|
+
|
23
|
+
#-- class setters and getters
|
24
|
+
attr_reader :xml_response
|
25
|
+
attr_accessor :guid, :username, :userkey, :content_type, :title, :blurb, :sourcefile, :callbackurl
|
26
|
+
|
27
|
+
# The initializer creates a set of instance variables to hold all the specifics about
|
28
|
+
# the video you're accessing. You can define these variables when instantiating a new
|
29
|
+
# MoovEngine object or after a blank object has been created. All variables with the
|
30
|
+
# exception of @xml_response and @action are writable. @xml_response is only readable
|
31
|
+
# because it contains the respnse from MoovAtom's servers. @action gets set in each of
|
32
|
+
# the methods below to correctly correspond with the associated request.
|
33
|
+
#
|
34
|
+
# Usage:
|
35
|
+
# * moov_engine = MoovAtom::MoovEngine.new
|
36
|
+
# * moov_engine.username = 'YOUR_USERNAME'
|
37
|
+
# * moov_engine.userkey = 'YOUR_USERKEY'
|
38
|
+
# * etc...
|
39
|
+
#
|
40
|
+
# Or:
|
41
|
+
# * args = { :username => 'YOUR_USERNAME', :userkey => 'YOUR_USERKEY', etc... }
|
42
|
+
# * moov_engine = MoovAtom::MoovEngine.new(args)
|
43
|
+
def initialize(args={})
|
44
|
+
@guid = args[:guid]
|
45
|
+
@username = args[:username]
|
46
|
+
@userkey = args[:userkey]
|
47
|
+
@content_type = args[:content_type] || "video"
|
48
|
+
@title = args[:title]
|
49
|
+
@blurb = args[:blurb]
|
50
|
+
@sourcefile = args[:sourcefile]
|
51
|
+
@callbackurl = args[:callbackurl]
|
52
|
+
end #-- end initialize method
|
53
|
+
|
54
|
+
# Use this method to get the details about a video that's finished encoding.
|
55
|
+
# This method requires @username, @userkey and @guid to be set.
|
56
|
+
#
|
57
|
+
# @TODO add the ability to yield to a block
|
58
|
+
#
|
59
|
+
# Usage:
|
60
|
+
# * moov_engine.details 'GUID_OF_VIDEO'
|
61
|
+
def details(guid)
|
62
|
+
@guid = guid
|
63
|
+
@action = 'details'
|
64
|
+
@xml_response = send_xml_request(build_xml_request)
|
65
|
+
end #-- end details method
|
66
|
+
|
67
|
+
# Use this method to get the status of a video that is currently being encoded.
|
68
|
+
# This method requires @username, @userkey and @guid to be set.
|
69
|
+
#
|
70
|
+
# @TODO add the ability to yield to a block
|
71
|
+
#
|
72
|
+
# Usage:
|
73
|
+
# * moov_engine.status 'GUID_OF_VIDEO'
|
74
|
+
def status(guid)
|
75
|
+
@guid = guid
|
76
|
+
@action = 'status'
|
77
|
+
@xml_response = send_xml_request(build_xml_request)
|
78
|
+
end #-- end status method
|
79
|
+
|
80
|
+
# Use this method to start encoding a new video.
|
81
|
+
# This method requires the following variables be set:
|
82
|
+
# * @username
|
83
|
+
# * @userkey
|
84
|
+
# * @content_type
|
85
|
+
# * @title
|
86
|
+
# * @blurb
|
87
|
+
# * @sourcefile
|
88
|
+
# * @callbackurl
|
89
|
+
#
|
90
|
+
# @TODO this method <b>REALLY</b> needs to be able to yield to a block!
|
91
|
+
#
|
92
|
+
# Usage:
|
93
|
+
# * moov_engine.status 'GUID_OF_VIDEO'
|
94
|
+
def encode
|
95
|
+
@action = 'encode'
|
96
|
+
@xml_response = send_xml_request(build_xml_request)
|
97
|
+
|
98
|
+
if @xml_response.code == "200"
|
99
|
+
xml_doc = REXML::Document.new @xml_response.body
|
100
|
+
@guid = xml_doc.root.elements["uuid"].text
|
101
|
+
end
|
102
|
+
end #-- end encode method
|
103
|
+
|
104
|
+
# Use this method to cancel the encoding of a video.
|
105
|
+
# This method requires @username, @userkey and @guid to be set.
|
106
|
+
#
|
107
|
+
# Usage:
|
108
|
+
# * moov_engine.cancel 'GUID_OF_VIDEO'
|
109
|
+
def cancel(guid)
|
110
|
+
@guid = guid
|
111
|
+
@action = 'cancel'
|
112
|
+
@xml_response = send_xml_request(build_xml_request)
|
113
|
+
end #-- end cancel method
|
114
|
+
|
115
|
+
#-- start of private methods
|
116
|
+
private
|
117
|
+
|
118
|
+
# Creates the XML object that is post'd to the MoovAtom servers
|
119
|
+
def build_xml_request
|
120
|
+
b = Builder::XmlMarkup.new
|
121
|
+
b.instruct!
|
122
|
+
xml = b.request do |r|
|
123
|
+
r.uuid(@guid)
|
124
|
+
r.username(@username)
|
125
|
+
r.userkey(@userkey)
|
126
|
+
r.action(@action)
|
127
|
+
r.content_type(@content_type)
|
128
|
+
r.title(@title)
|
129
|
+
r.blurb(@blurb)
|
130
|
+
r.sourcefile(@sourcefile)
|
131
|
+
r.callbackurl(@callbackurl)
|
132
|
+
end
|
133
|
+
end #-- end build_xml_request method
|
134
|
+
|
135
|
+
# Sends the XML object to the MoovAtom servers
|
136
|
+
def send_xml_request(xml)
|
137
|
+
uri = URI.parse(MoovAtom::API_URL)
|
138
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
139
|
+
http.use_ssl = true
|
140
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
141
|
+
response = http.post(uri.request_uri, "xml=#{URI.escape(xml)}")
|
142
|
+
end #-- end send_xml_request method
|
143
|
+
|
144
|
+
end #-- end MoovEngine class
|
145
|
+
|
146
|
+
end #-- end MoovAtom module
|
data/moovatom.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "moovatom/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
|
7
|
+
#-- author info
|
8
|
+
s.authors = ["Dominic Giglio"]
|
9
|
+
s.email = ["humanshell@gmail.com"]
|
10
|
+
s.homepage = "http://moovatom.com"
|
11
|
+
|
12
|
+
#-- gem info
|
13
|
+
s.name = "moovatom"
|
14
|
+
s.version = MoovAtom::VERSION
|
15
|
+
s.summary = %q{Access MoovAtom API}
|
16
|
+
s.description = %q{This gem defines methods for controlling your videos on MoovAtom using the MoovEngine API.}
|
17
|
+
s.rubyforge_project = "moovatom"
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
#-- dependency info
|
24
|
+
s.add_dependency('builder')
|
25
|
+
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moovatom
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dominic Giglio
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-10 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: builder
|
16
|
+
requirement: &70127118816140 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70127118816140
|
25
|
+
description: This gem defines methods for controlling your videos on MoovAtom using
|
26
|
+
the MoovEngine API.
|
27
|
+
email:
|
28
|
+
- humanshell@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- LICENSE.txt
|
36
|
+
- README.md
|
37
|
+
- 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
|
+
- init.rb
|
74
|
+
- lib/moovatom.rb
|
75
|
+
- lib/moovatom/version.rb
|
76
|
+
- moovatom.gemspec
|
77
|
+
homepage: http://moovatom.com
|
78
|
+
licenses: []
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project: moovatom
|
97
|
+
rubygems_version: 1.8.10
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Access MoovAtom API
|
101
|
+
test_files: []
|