| Class | Viddler::Base |
| In: |
lib/viddler/base.rb
|
| Parent: | Object |
A class that can be instantiated for access to a Viddler API.
Examples:
@viddler = Viddler::Base.new(API_KEY, USERNAME, PASSWORD)
Username and password are optional, some API methods doesn‘t require them:
@viddler = Viddler::Base.new(YOUR_API_KEY)
Implements viddler.users.auth.
It‘s not necessary for you to call this method manually before each method that requires authentication. Viddler.rb will do that for you automatically. You can use this method for checking credentials and for trying if connection to Viddler works.
Example:
@viddler.authenticate
Returns a string with session id.
Implements viddler.videos.getFeatured.
Example:
@viddler.find_all_featured_videos
Returns array of Viddler::Video instances.
Implements viddler.videos.getByTag.
Options hash could contain next values:
Example:
@viddler.find_all_videos_by_tag('super tag', :per_page => 5)
Returns array of Viddler::Video instances.
Implements viddler.videos.getByUser. Authentication is optional.
Options hash could contain next values:
Example:
@viddler.find_all_videos_by_user(username, :page => 2)
Returns array of Viddler::Video instances.
Implements viddler.users.getProfile.
Example:
@viddler.find_profile(viddler_username)
Returns Viddler::User instance.
Implements viddler.videos.getDetails. Authentication is optional.
Example:
@viddler.find_video_by_id(video_id)
Returns Viddler::Video instance.
Implements viddler.videos.getDetailsByUrl. Authentication is optional.
Example:
@viddler.find_video_by_url('http://www.viddler.com/explore/username/videos/video_num/')
Returns Viddler::Video instance.
Implements viddler.videos.getRecordToken.
Example:
@viddler.get_record_token
Returns a string with record token.
Implements viddler.videos.getStatus.
Example:
@viddler.get_video_status(video_id)
This methods returns OpenStruct instance with Viddler‘s status information on a given video. We don‘t control what Viddler returns and it‘s all basically technical internal information of Viddler. Use this on your own risk.
Implements viddler.users.register. Restricted to Viddler qualified API keys only.
new_attributes hash should contain next required keys:
and could contain next optional keys:
Example:
@viddler.register_user(:user => 'login', :email => 'mail@example.com', ...)
Returns new user‘s username string.
Implements viddler.users.setOptions. Requires authentication. Restricted to Viddler partners only.
new_attributes hash could contain next optional keys:
Example:
@viddler.update_account(:show_account => '0')
Returns number of updated parameters.
Implements viddler.users.setProfile. Requires authentication.
new_attributes hash could contain next optional keys:
Example:
@viddler.update_profile(:first_name => 'Vasya', :last_name => 'Pupkin')
Returns Viddler::User instance.
Implements viddler.videos.setDetails. Requires authentication.
new_attributes hash could contain next optional keys:
Example:
@viddler.update_video(video_id, :title => 'Brand new title')
Returns Viddler::Video instance.
Implements viddler.videos.upload. Requires authentication.
new_attributes hash should contain next required keys:
Example:
@viddler.upload_video(:title => 'Great Title', :file => File.open('/movies/movie.mov'), ...)
Returns Viddler::Video instance.