Class: Mailarchiva::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Client

Returns a new instance of Client.



10
11
12
13
# File 'lib/mailarchiva.rb', line 10

def initialize(args)
  args = {client: :soap, ssl: false, port: 8090, app_name: 'ROOT'}.merge(args)
  @client = args[:client] == :rest ? RestClient.new(args) : SoapClient.new(args)
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



8
9
10
# File 'lib/mailarchiva.rb', line 8

def client
  @client
end

Instance Method Details

#get_mail_message(blob_id, volume_id) ⇒ Object



36
37
38
# File 'lib/mailarchiva.rb', line 36

def get_mail_message(blob_id, volume_id)
  @client.get_mail_message(blob_id, volume_id)
end

#get_message(blob_id, volume_id) ⇒ Object



32
33
34
# File 'lib/mailarchiva.rb', line 32

def get_message(blob_id, volume_id)
  @client.get_message(blob_id, volume_id)
end

#search(params) ⇒ Object



28
29
30
# File 'lib/mailarchiva.rb', line 28

def search(params)
  @client.search(params)
end

#search_by_subject(subject, params = {}) ⇒ Object

blob_category ‘email’ query ‘subject:test’ | ‘allsenders:[email protected]’ sort_field ‘sentdate’ | ‘archivedate’ | ‘receiveddate’ sort_order ‘sentdate’ | ‘archivedate’ | ‘receiveddate’ date_type ‘sentdate’ | ‘archivedate’ | ‘receiveddate’ sent_before “2015-06-20T14:57:27” | Time object sent_after “2015-06-20T14:57:27” | Time object max_results 1000



23
24
25
26
# File 'lib/mailarchiva.rb', line 23

def search_by_subject(subject, params={})
  {query: "subject:\"#{subject}\""}.merge!(params)
  @client.search(params)
end