Class: Libis::Services::CollectiveAccess::Connector
- Inherits:
-
Object
- Object
- Libis::Services::CollectiveAccess::Connector
- Includes:
- SoapClient
- Defined in:
- lib/libis/services/collective_access/connector.rb
Overview
noinspection RubyStringKeysInHashInspection
Direct Known Subclasses
Instance Attribute Summary collapse
-
#type_cast ⇒ Object
Returns the value of attribute type_cast.
Attributes included from SoapClient
Instance Method Summary collapse
- #authenticate(name = nil, password = nil) ⇒ Object
- #deauthenticate ⇒ Object
-
#initialize(service, host = nil) ⇒ Connector
constructor
A new instance of Connector.
Methods included from SoapClient
#configure, #operations, #request
Constructor Details
#initialize(service, host = nil) ⇒ Connector
Returns a new instance of Connector.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/libis/services/collective_access/connector.rb', line 15 def initialize(service, host = nil) @type_cast = true @host = host || 'http://crkc.be.halotest.cc.kuleuven.be/ca_crkc' @service = service configure "#{@host}/service.php/#{@service.downcase}/#{@service}/soapWSDL?wsdl", convert_request_keys_to: :none, # convert_response_tags_to: lambda { # |tag| %w(Envelope Body).include?(tag) ? tag.snakecase.to_sym : tag.to_sym # }, strip_namespaces: true end |
Instance Attribute Details
#type_cast ⇒ Object
Returns the value of attribute type_cast.
13 14 15 |
# File 'lib/libis/services/collective_access/connector.rb', line 13 def type_cast @type_cast end |
Instance Method Details
#authenticate(name = nil, password = nil) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/libis/services/collective_access/connector.rb', line 27 def authenticate(name = nil, password = nil) name ||= 'administrator' password ||= 'administrator' result = request :auth, username: name, password: password result.to_i == 1 end |
#deauthenticate ⇒ Object
34 35 36 |
# File 'lib/libis/services/collective_access/connector.rb', line 34 def deauthenticate request :deauthenticate end |