Method: Viddler::Client#post

Defined in:
lib/viddler/client.rb

#post(method, arguments = {}) ⇒ Object

Public: Make a POST call to the Viddler API.

method - The String API method you’d like to call. arguments - The Hash of arguments to the API method (default: {}).

Examples

viddler.post 'viddler.videos.setDetails', :video_id => 'abc123',
                                          :title    => 'new title'

Returns a Hash containing the API response. Raises ApiException if an error is returned from the API.



97
98
99
100
101
102
103
# File 'lib/viddler/client.rb', line 97

def post(method, arguments={})
  arguments[:api_key]   = api_key
  arguments[:sessionid] = sessionid if authenticated?
  JSON.parse RestClient.post(DEFAULT_ENDPOINT + method + '.json', arguments)
rescue RestClient::ExceptionWithResponse => e
  raise_api_exception e
end