Module: Cetustek::Soap

Overview

Shared SOAP plumbing: every operation hits the same WSDL and authenticates with 網站代碼+APIPassword (source) and the 租賃者統編 (rentid).

Instance Method Summary collapse

Instance Method Details

#rentidObject



17
18
19
# File 'lib/cetustek/soap.rb', line 17

def rentid
  Cetustek.config.username
end

#soap_call(operation, message) ⇒ Object



21
22
23
# File 'lib/cetustek/soap.rb', line 21

def soap_call(operation, message)
  soap_client.call(operation, message: message.merge(source: source, rentid: rentid))
end

#soap_clientObject



9
10
11
# File 'lib/cetustek/soap.rb', line 9

def soap_client
  Savon.client(wsdl: Cetustek.config.url, open_timeout: 300, read_timeout: 300)
end

#soap_return(response, operation) ⇒ Object



25
26
27
# File 'lib/cetustek/soap.rb', line 25

def soap_return(response, operation)
  response.body[:"#{operation}_response"][:return]
end

#sourceObject



13
14
15
# File 'lib/cetustek/soap.rb', line 13

def source
  Cetustek.config.site_id + Cetustek.config.password
end