Module: Kaltura::ClientResource

Included in:
MediaEntry, Session
Defined in:
lib/kaltura/client_resource.rb

Instance Method Summary collapse

Instance Method Details

#fetch(service, action, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/kaltura/client_resource.rb', line 4

def fetch(service, action, options = {})
  _kickstart_session!

  response = HTTParty.get(url, 
                          :query => _standard_options(service, action, options), 
                          :format => :xml)
  _verify_http_code!(response, 200) { raise FetchError, "Fetch failed, HTTP error: #{response.code}" }
  mashes = _mashes_from_response(response)
  return_mash = mashes.map { |m| new(m) }

  _verify_kaltura_error!(return_mash)
end

#post(service, action, options = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/kaltura/client_resource.rb', line 17

def post(service, action, options = {})
  options[:service] = service
  options[:action] = action
  response = HTTParty.post(url, :body => options, :format => :xml)
  _verify!(response, 201) { raise CreateError, "Create failed, HTTP error: #{response.code}" }
end

#urlObject



24
25
26
# File 'lib/kaltura/client_resource.rb', line 24

def url
  "#{Kaltura.config.service_url}/api_v3/"
end