class GaroonCat

Constants

VERSION

Attributes

services[R]

@return [Hash<Symbol => GaroonCat::Service>]

uri[R]

@return [URI]

Public Class Methods

setup(uri:, username:nil, password:nil) click to toggle source

@param uri [URI, String] URI to WSDL @param username [String] a username for WS-Security @param password [String] a password for WS-Security @return [GaroonCat]

# File lib/garoon-cat.rb, line 20
def self.setup(uri:, username:nil, password:nil)
  client = GaroonCat::Client.new(username:username, password:password)
  uri = uri.kind_of?(URI) ? uri : URI.parse(uri.to_s)
  services = {}
  doc = REXML::Document.new(client.get(uri))
  REXML::XPath.match(doc, '/definitions/service').each do |service|
    name = service.attribute('name').value
    key = name.camelize.sub(/Service$/, '').underscore.to_sym
    location = URI.parse(service.elements['port/soap12:address'].attribute('location').value)
    services[key] = GaroonCat::Service.new(client:client, name:name, uri:location)
  end
  new(client:client, uri:uri, services:services)
end

Private Class Methods

new(client:, uri:, services:) click to toggle source

@param client [GaroonCat::Client] @param uri [URI] @param services [Hash<Symbol => GaroonCat::Service>]

# File lib/garoon-cat.rb, line 37
def initialize(client:, uri:, services:)
  @client = client
  @uri = uri
  @services = services
end

Public Instance Methods

service(key) click to toggle source

@param key [Symbol, String] @return [GaroonCat::Service]

# File lib/garoon-cat.rb, line 46
def service(key)
  @services[key]
end