class Mailarchiva::SoapClient

Attributes

soap_client[RW]

Public Class Methods

new(args) click to toggle source
Calls superclass method Mailarchiva::Base::new
# File lib/mailarchiva/soap_client.rb, line 13
def initialize(args)
  super(args)
end

Public Instance Methods

get_mail_message(blob_id, volume_id) click to toggle source
# File lib/mailarchiva/soap_client.rb, line 45
def get_mail_message(blob_id, volume_id)
  message = get_message(blob_id, volume_id)
  Mail.new(message)
end
get_message(blob_id, volume_id) click to toggle source
# File lib/mailarchiva/soap_client.rb, line 39
def get_message(blob_id, volume_id)
  blob_response = soap_client.call(:get_blob, message: { 'blobID' =>{ 'blobID' => blob_id, 'volumeID' => volume_id } })
  encoded_message = blob_response.body[:get_blob_response][:return][:blob]
  decoded_message = Base64.decode64(encoded_message)
end
logged_in?() click to toggle source
# File lib/mailarchiva/soap_client.rb, line 66
def logged_in?
  @session_id.nil? ? false : soap_client.call(:is_logged_in).body[:is_logged_in_response][:return]
end
login(client) click to toggle source
# File lib/mailarchiva/soap_client.rb, line 61
def login(client)
  response = client.call(:login, message: { applicationname: @app_name, username: @user, password: @pass })
  response.http.cookies.first.name_and_value
end
logout() click to toggle source
# File lib/mailarchiva/soap_client.rb, line 70
def logout
  soap_client.call(:logout, message: {})
  @soap_client = nil
end
search_result_size() click to toggle source
# File lib/mailarchiva/soap_client.rb, line 34
def search_result_size
  search_result_size_response = soap_client.call(:get_search_result_size)
  search_result_size_response.body[:get_search_result_size_response][:return].to_i
end
search_results_from_response(response) click to toggle source
# File lib/mailarchiva/soap_client.rb, line 27
def search_results_from_response(response)
  return [] if search_result_size == 0
  search_results_response = soap_client.call(:get_search_results, message: { blob_category: 'email', start: 0, end: search_result_size })
  search_results = [ search_results_response.body[:get_search_results_response][:return] ].flatten.compact
  search_results.map{|field_values| Message.new(self, field_values)}
end
wsdl() click to toggle source
# File lib/mailarchiva/soap_client.rb, line 50
def wsdl
  "%s://%s:%s/services/search?wsdl" % [@ssl ? 'https' : 'http', @host, @port]
end