Class: Kaltura::Service::BaseService

Inherits:
Object
  • Object
show all
Defined in:
lib/kaltura/service/base_service.rb

Overview

Base Service is a method extraction refactoring performed on the Service module for the Velir branch of the kaltura-ruby library. Previously perform_request existed in each method of each service.

Author:

  • Patrick Robertson

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BaseService

Returns a new instance of BaseService.



13
14
15
# File 'lib/kaltura/service/base_service.rb', line 13

def initialize(client)
	@client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



11
12
13
# File 'lib/kaltura/service/base_service.rb', line 11

def client
  @client
end

Instance Method Details

#perform_request(service_class, service_action, paramters, allow_multirequest = true) ⇒ Object

Enqueues the service class, action, and paramters onto the client object and then informs the client object to perform pop an action off the queue.

Parameters:

  • service_class (String)

    The particular class within the Service module.

    This translates to a paramter of service=service_class on the http request.

  • service_action (String)

    The action method performed by the service_class. This translates to a parameter of action=service_action on the http request.

  • allow_multirequest (Boolean) (defaults to: true)

    I’ve never seen this implemented. It’s around just in case though.

Returns:

  • (Object)

    Returns the result of the request.

Raises:



32
33
34
35
36
37
38
39
# File 'lib/kaltura/service/base_service.rb', line 32

def perform_request(service_class,service_action,paramters,allow_multirequest=true)
  if allow_multirequest == false && client.is_multirequest
    return nil
  else
    client.queue_service_action_call(service_class,service_action,paramters)
    return client.do_queue
  end
end