Class: Vidly
Class Method Summary collapse
Instance Method Summary collapse
- #import(url, options = {}) ⇒ Object
- #import_and_post(url, options = {}) ⇒ Object
-
#initialize(username, password) ⇒ Vidly
constructor
A new instance of Vidly.
- #status(id) ⇒ Object
- #upload(file, options = {}) ⇒ Object
- #upload_and_post(file, options = {}) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Vidly
Returns a new instance of Vidly.
16 17 18 |
# File 'lib/vidly.rb', line 16 def initialize(username, password) @auth = {:username => username, :password => password} end |
Class Method Details
.meta(url) ⇒ Object
48 49 50 |
# File 'lib/vidly.rb', line 48 def self.(url) mashup(get("/import/meta.json", :query => {:url => url})) end |
.url(id) ⇒ Object
52 53 54 |
# File 'lib/vidly.rb', line 52 def self.url(id) "http://vid.ly/#{id}" end |
.videos(username) ⇒ Object
44 45 46 |
# File 'lib/vidly.rb', line 44 def self.videos(username) mashup(get("/videos/#{username}.json")) end |
Instance Method Details
#import(url, options = {}) ⇒ Object
28 29 30 |
# File 'lib/vidly.rb', line 28 def import(url, ={}) self.class.mashup(self.class.post("/import.json", {:basic_auth => @auth, :body => .merge(.merge({:url => url})) })) end |
#import_and_post(url, options = {}) ⇒ Object
32 33 34 |
# File 'lib/vidly.rb', line 32 def import_and_post(url, ={}) self.class.mashup(self.class.post("/importAndPost.json", {:basic_auth => @auth, :body => .merge(.merge({:url => url})) })) end |
#status(id) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/vidly.rb', line 36 def status(id) info = self.class.mashup(self.class.post("/status.json", {:basic_auth => @auth, :body => {:id => id}})) %w(views retweets likes).each do |key| info.[key] = info.[key].to_i end info end |
#upload(file, options = {}) ⇒ Object
20 21 22 |
# File 'lib/vidly.rb', line 20 def upload(file, ={}) upload_file("/upload.json", file, ) end |
#upload_and_post(file, options = {}) ⇒ Object
24 25 26 |
# File 'lib/vidly.rb', line 24 def upload_and_post(file, ={}) upload_file("/uploadAndPost.json", file, ) end |