mailarchiva 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58b94112e4d955b6fb03076b5bcec80b848b4dd6
4
- data.tar.gz: 8de714758142b6121ba371cc5c2db6420ff69f0c
3
+ metadata.gz: 41e3e9824eb3820d79e750d896cace673c81698c
4
+ data.tar.gz: 80db243fdea3506e2fcb56e3b6346b1e8dd73cb3
5
5
  SHA512:
6
- metadata.gz: 9ac04b43d2db0a0aa12c423c13f1515c74bfade632bb60df2ba4a82960a4ebafc79c4b246c3f0976f18a5c3891467512d522bcfcfde5973bdd9c620882dd9f6b
7
- data.tar.gz: 44044d80ae166f561da5e8e09ddea68e7b086c22dfa68eaf21a366b965b351bfc767a9a2af8cd1e4f84b78ca47bd6a5a8c768dbc9f7f96efdbbba97c85469616
6
+ metadata.gz: 1f449ee0c0b6a9f32d551481722507e95a081c8cc67c5df720ae1c68a63c05027802f8d4de9d318dd72b2e659bd45e8e1ae8e8dc6edc884f90f139521d56c6f6
7
+ data.tar.gz: 434a12efb2ba4774d671326f6252cc5e928c569efe11b2173c968669c8df948add8bc91ea2cf788fa18bf04c25909afd82324b423aa188e2e7c4a98fd242c0f9
data/README.md CHANGED
@@ -8,6 +8,11 @@ mailarchiva = Mailarchiva::Client.new(host: '192.168.1.1', user: 'user', pass: '
8
8
  results = mailarchiva.search_by_subject('test') # An array of Mailarchiva::Message
9
9
 
10
10
  mailarchiva.get_message(results.first) # A Mail message
11
+
12
+ sent_before = Time.now.strftime("%Y/%m/%d %I:%M%p")
13
+ sent_after = (Time.now - 86400).strftime("%Y/%m/%d %I:%M%p")
14
+ params = {sent_after: sent_after, sent_before: sent_before, query: "allsenders=\"e09des0237t@sepdf.gob.mx\""}
15
+ mailarchiva_messages = mailarchiva.search(params)
11
16
  ```
12
17
 
13
18
  [Mailarchiva]:https://www.mailarchiva.com/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/lib/mailarchiva.rb CHANGED
@@ -1,5 +1,3 @@
1
- # https://www.mailarchiva.com/help/display/MAIL/Web+Services+API
2
-
3
1
  require 'mailarchiva/rest_client'
4
2
  require 'mailarchiva/soap_client'
5
3
 
@@ -10,12 +8,12 @@ module Mailarchiva
10
8
  attr_accessor :client
11
9
 
12
10
  def initialize(args)
13
- args.reverse_merge!({client: :soap, ssl: false, port: 8090, app_name: 'ROOT'})
11
+ args = {client: :soap, ssl: false, port: 8090, app_name: 'ROOT'}.merge(args)
14
12
  @client = args[:client] == :rest ? RestClient.new(args) : SoapClient.new(args)
15
13
  end
16
14
 
17
15
  # blob_category 'email'
18
- # query 'subject:test'
16
+ # query 'subject:test' | 'allsenders:test@test.com'
19
17
  # sort_field 'sentdate' | 'archivedate' | 'receiveddate'
20
18
  # sort_order 'sentdate' | 'archivedate' | 'receiveddate'
21
19
  # date_type 'sentdate' | 'archivedate' | 'receiveddate'
@@ -23,7 +21,11 @@ module Mailarchiva
23
21
  # sent_after "2015-06-20T14:57:27" | Time object
24
22
  # max_results 1000
25
23
  def search_by_subject(subject, params={})
26
- params.reverse_merge!({query: "subject:\"#{subject}\""})
24
+ {query: "subject:\"#{subject}\""}.merge!(params)
25
+ @client.search(params)
26
+ end
27
+
28
+ def search(params)
27
29
  @client.search(params)
28
30
  end
29
31
 
@@ -1,5 +1,5 @@
1
1
  require 'mailarchiva/base'
2
- require 'mailarchiva/message'
2
+ require 'message'
3
3
  require 'savon'
4
4
 
5
5
  module Mailarchiva
@@ -14,8 +14,8 @@ module Mailarchiva
14
14
  super(args)
15
15
  end
16
16
 
17
- def search(params={})
18
- params.reverse_merge!({blob_category: 'email', max_results: 1000})
17
+ def search(params)
18
+ params = {blob_category: 'email', max_results: 1000}.merge(params)
19
19
  params[:sent_before] = params[:sent_before].strftime("%Y-%m-%dT%T") if params.has_key?(:sent_before) && params[:sent_before].is_a?(Time)
20
20
  params[:sent_after] = params[:sent_after].strftime("%Y-%m-%dT%T") if params.has_key?(:sent_after) && params[:sent_after].is_a?(Time)
21
21
  search_response = soap_client.call(:search, message: params)
@@ -44,7 +44,7 @@ module Mailarchiva
44
44
  end
45
45
 
46
46
  def wsdl
47
- "%s://%s:%s/services/search?wsdl" % [ssl ? 'https' : 'http', host, port]
47
+ "%s://%s:%s/services/search?wsdl" % [@ssl ? 'https' : 'http', @host, @port]
48
48
  end
49
49
 
50
50
  def soap_client
data/mailarchiva.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: mailarchiva 0.0.5 ruby lib
5
+ # stub: mailarchiva 0.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "mailarchiva"
9
- s.version = "0.0.5"
9
+ s.version = "0.0.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["David John"]
14
- s.date = "2015-06-30"
14
+ s.date = "2015-07-14"
15
15
  s.description = "A gem to access the Mailarchiva API"
16
16
  s.email = "dj@dbjohn.com"
17
17
  s.extra_rdoc_files = [
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
  ]
38
38
  s.homepage = "http://github.com/Archdiocese-of-New-Orleans/mailarchiva"
39
39
  s.licenses = ["MIT"]
40
- s.rubygems_version = "2.4.2"
40
+ s.rubygems_version = "2.4.8"
41
41
  s.summary = "Access the Mailarchiva API"
42
42
 
43
43
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailarchiva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David John
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.4.2
154
+ rubygems_version: 2.4.8
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Access the Mailarchiva API