Sha256: 6b20c7addccb9a70caffa273c511ab436f9a7e4e4a7c178702fd9b649c2f108a

Contents?: true

Size: 1021 Bytes

Versions: 2

Compression:

Stored size: 1021 Bytes

Contents

# https://www.mailarchiva.com/help/display/MAIL/Web+Services+API

require 'mailarchiva/rest_client'
require 'mailarchiva/soap_client'

module Mailarchiva

  class Client

    attr_accessor :client

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

    # blob_category 'email'
    # query 'subject:test'
    # 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
    def search_by_subject(subject, params={})
      params.reverse_merge!({query: "subject:\"#{subject}\""})
      @client.search(params)
    end

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

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailarchiva-0.0.5 lib/mailarchiva.rb
mailarchiva-0.0.4 lib/mailarchiva.rb