Class: LUSI::API::ServiceMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/lusi_api/service_method.rb

Overview

Represents a LUSI API service method

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml = nil, lookup = nil, web_service: nil, url: nil, endpoint: nil, method_name: nil) ⇒ ServiceMethod

Initialize a new ServiceMethod instance Fields are extracted from the parsed XML from the LUSI API response. A single <ServiceMethod> element is expected. Default values for fields missing from the XML can be specified as keyword arguments.

Parameters:

  • xml (Nokogiri::XML::Node, Nokogiri:nil) (defaults to: nil)

    the XML response from the LUSI GetServiceAccountDetails API call, or nil

  • lookup (LUSI::API::Core::Lookup::LookupService, nil) (defaults to: nil)

    the lookup service for object resolution

  • web_service (String, nil) (defaults to: nil)

    the default web service name

  • url (Stirng, nil) (defaults to: nil)

    the default URL

  • endpoint (String, nil) (defaults to: nil)

    the default endpoint name

  • method_name (String, nil) (defaults to: nil)

    the default method name



35
36
37
38
39
40
# File 'lib/lusi_api/service_method.rb', line 35

def initialize(xml = nil, lookup = nil, web_service: nil, url: nil, endpoint: nil, method_name: nil)
  @web_service = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:WebService', web_service)
  @url = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Url', url)
  @endpoint = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:EndPoint', endpoint)
  @method_name = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:MethodName', method_name)
end

Instance Attribute Details

#endpointString

Returns the endpoint component of the web service address (e.g. ‘General.asmx’).

Returns:

  • (String)

    the endpoint component of the web service address (e.g. ‘General.asmx’)



12
13
14
# File 'lib/lusi_api/service_method.rb', line 12

def endpoint
  @endpoint
end

#method_nameString

Returns the method name of the web service (e.g. ‘GetServiceAccountDetails’).

Returns:

  • (String)

    the method name of the web service (e.g. ‘GetServiceAccountDetails’)



16
17
18
# File 'lib/lusi_api/service_method.rb', line 16

def method_name
  @method_name
end

#urlString

Returns the web service URL root, excluding the endpoint and method name.

Returns:

  • (String)

    the web service URL root, excluding the endpoint and method name



20
21
22
# File 'lib/lusi_api/service_method.rb', line 20

def url
  @url
end

#web_serviceString

Returns the web service name.

Returns:

  • (String)

    the web service name



24
25
26
# File 'lib/lusi_api/service_method.rb', line 24

def web_service
  @web_service
end

Instance Method Details

#to_sString

Return a string representation of the ServiceMethod instance (the full URL path)

Returns:

  • (String)

    the string representation of the ServiceMethod instance



44
45
46
# File 'lib/lusi_api/service_method.rb', line 44

def to_s
  "#{@url}/#{@endpoint}/#{@method_name}"
end