class CONTENTdmAPI::Service
A class to tell the Request
class which function, params and format to request of the CONTENTdm API
Attributes
format[R]
function[R]
params[R]
Public Class Methods
new(function: 'wsAPIDescribe', params: [], format: 'json')
click to toggle source
@param [String] function function A CONTENTdm function @param [Array] params A set of params for a given function. Parameters
must be passed as an array in the order specified in the CONTENTdm API documentation. "http://CdmServer.com:port/dmwebservices/index.php"
@param [String] format Either XML or JSON. Defaults to JSON.
@return [Void]
# File lib/contentdm_api/service.rb, line 15 def initialize(function: 'wsAPIDescribe', params: [], format: 'json') @format = format @function = function @params = params end
Public Instance Methods
url_params()
click to toggle source
URL params for a given service
@return [String] A CONTENTdm formatted url parameter string
# File lib/contentdm_api/service.rb, line 24 def url_params "#{function}/#{all_params.join('/')}" end
Private Instance Methods
all_params()
click to toggle source
# File lib/contentdm_api/service.rb, line 30 def all_params params.concat([format]).uniq end