mailarchiva 0.0.7 → 0.0.8

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: 3bc79d37d5de07831e46c8c131356636805ac877
4
- data.tar.gz: 37ee5b9240eb6baf5542298cb66dc8ddd367b6e2
3
+ metadata.gz: e4ab32f91ad6dd35165e78d5f3dbfbd0302fb25f
4
+ data.tar.gz: afa297e123932876c743ffae28fb1b4cc9e57ab9
5
5
  SHA512:
6
- metadata.gz: 60850eb42125672fe1ab4c375e8716ccd85221448b0b7a2363c860192d007f399c7444162e379467b8de847394c76221e53e2e57a0ce3535f5d229ebfb8bbc50
7
- data.tar.gz: 2d6ecc21637f1a385e6028e4d89eb3d28b61c1f5ab4939e246f088d37723b4ce5ded91bbccd77572f7095c0174c516cbdd5ab3a8d07658ff3938f577d0c14460
6
+ metadata.gz: 9dd942a89824d65f87ec4b79953d3eec79d03dc9c09d0d40dc5a61ad2adbc79756821f9e580ad44d4fd8d9192e1dd18de73e6534d9ddcf13912bb62adaddeabe
7
+ data.tar.gz: c9e3d4263d3fdd0c096d2c44b5d2813b9cf3596835f3edf576774dfce683707a0f371e499ed843b14e51ee5b840ab3a66f40f8f7049f0bc4413f40e214b15a56
data/Gemfile CHANGED
@@ -6,9 +6,9 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "shoulda", ">= 0"
10
- gem "rdoc", "~> 3.12"
11
9
  gem "bundler", "~> 1.0"
12
10
  gem "jeweler", "~> 2.0"
13
- gem "simplecov", ">= 0"
14
11
  end
12
+
13
+ gem 'mail', '~> 2.6'
14
+ gem 'savon', '~> 2.10'
data/README.md CHANGED
@@ -5,15 +5,17 @@ A ruby gem to access the [Mailarchiva] API. Refer to the [Mailarchiva API] for
5
5
  ```ruby
6
6
  require 'mailarchiva'
7
7
  mailarchiva = Mailarchiva::Client.new(host: '192.168.1.1', user: 'user', pass: 'pass')
8
- results = mailarchiva.search_by_subject('test') # An array of Mailarchiva::Message
9
-
10
- mailarchiva.get_message(results.first) # A Mail message
8
+ mailarchiva_messages = mailarchiva.search_by_subject('test') # An array of Mailarchiva::Message
9
+ mailarchiva_message = results.first # A Mailarchiva::Message
10
+ mailarchiva_message.mail_message # A Mail::Message
11
11
 
12
12
  sent_before = Time.now.strftime("%Y/%m/%d %I:%M%p")
13
13
  sent_after = (Time.now - 86400).strftime("%Y/%m/%d %I:%M%p")
14
14
  params = {sent_after: sent_after, sent_before: sent_before, query: "allsenders=\"e09des0237t@sepdf.gob.mx\""}
15
15
  mailarchiva_messages = mailarchiva.search(params)
16
16
  ```
17
+ ## TODO
18
+ test
17
19
 
18
20
  [Mailarchiva]:https://www.mailarchiva.com/
19
- [Mailarchiva API]:https://www.mailarchiva.com/help/display/MAIL/Web+Services+API
21
+ [Mailarchiva API]:https://www.mailarchiva.com/help/display/MAIL/Web+Services+API
data/Rakefile CHANGED
@@ -22,32 +22,6 @@ Jeweler::Tasks.new do |gem|
22
22
  gem.email = "dj@dbjohn.com"
23
23
  gem.authors = ["David John"]
24
24
  # dependencies defined in Gemfile
25
- gem.add_dependency 'savon', '~> 2.10'
26
- gem.add_dependency 'mail', '~> 2.6'
27
25
  end
28
- Jeweler::RubygemsDotOrgTasks.new
29
26
 
30
- require 'rake/testtask'
31
- Rake::TestTask.new(:test) do |test|
32
- test.libs << 'lib' << 'test'
33
- test.pattern = 'test/**/test_*.rb'
34
- test.verbose = true
35
- end
36
-
37
- desc "Code coverage detail"
38
- task :simplecov do
39
- ENV['COVERAGE'] = "true"
40
- Rake::Task['test'].execute
41
- end
42
-
43
- task :default => :test
44
-
45
- require 'rdoc/task'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
-
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "mailarchiva #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
53
- end
27
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -1,10 +1,13 @@
1
+ require "mail"
2
+
1
3
  module Mailarchiva
2
4
 
3
5
  class Message
4
6
 
5
- attr_accessor :blob_id, :volume_id, :size, :sentdate, :receiveddate, :archivedate, :from, :to, :subject, :cc, :bcc, :deliveredto, :messageid, :rcptto, :mailfrom
7
+ attr_accessor :client, :blob_id, :volume_id, :size, :sentdate, :receiveddate, :archivedate, :from, :to, :subject, :cc, :bcc, :deliveredto, :messageid, :rcptto, :mailfrom
6
8
 
7
- def initialize(field_values)
9
+ def initialize(client, field_values)
10
+ @client = client
8
11
  field_values[:field_values].each do |field|
9
12
  key = field[:field]
10
13
  value = field[:value]
@@ -22,5 +25,31 @@ module Mailarchiva
22
25
  @volume_id = field_values[:id][:volume_id]
23
26
  end
24
27
 
28
+ def raw_from
29
+ @from
30
+ end
31
+
32
+ def from
33
+ @from.match(/<(.*)>/).captures.first
34
+ end
35
+
36
+ def raw_to
37
+ @to
38
+ end
39
+
40
+ def to
41
+ undisclosed_recipients? ? mail_message.header.fields.select{|field| field.name =~ /received/i && field.value =~ /\sfor\s<(.*)>/i }.collect{|field| field.value.match(/\sfor\s<(.*)>/).captures.first}.uniq.join : @to.match(/<(.*)>/).captures.first
42
+ end
43
+
44
+ def mail_message
45
+ @mail_message = begin
46
+ @client.get_message(@blob_id, @volume_id)
47
+ end
48
+ end
49
+
50
+ def undisclosed_recipients?
51
+ (@to =~ /undisclosed-recipients/i) == 1
52
+ end
53
+
25
54
  end
26
55
  end
@@ -28,7 +28,7 @@ module Mailarchiva
28
28
  return [] if search_result_size == 0
29
29
  search_results_response = soap_client.call(:get_search_results, message: { blob_category: 'email', start: 0, end: search_result_size })
30
30
  search_results = [ search_results_response.body[:get_search_results_response][:return] ].flatten.compact
31
- search_results.map{|field_values| Message.new(field_values)}
31
+ search_results.map{|field_values| Message.new(self, field_values)}
32
32
  end
33
33
 
34
34
  def search_result_size
data/mailarchiva.gemspec CHANGED
@@ -2,11 +2,11 @@
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.7 ruby lib
5
+ # stub: mailarchiva 0.0.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "mailarchiva"
9
- s.version = "0.0.7"
9
+ s.version = "0.0.8"
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"]
@@ -44,30 +44,21 @@ Gem::Specification.new do |s|
44
44
  s.specification_version = 4
45
45
 
46
46
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
- s.add_development_dependency(%q<shoulda>, [">= 0"])
48
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
+ s.add_runtime_dependency(%q<mail>, ["~> 2.6"])
48
+ s.add_runtime_dependency(%q<savon>, ["~> 2.10"])
49
49
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
50
50
  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
51
- s.add_development_dependency(%q<simplecov>, [">= 0"])
52
- s.add_runtime_dependency(%q<savon>, ["~> 2.10"])
53
- s.add_runtime_dependency(%q<mail>, ["~> 2.6"])
54
51
  else
55
- s.add_dependency(%q<shoulda>, [">= 0"])
56
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
+ s.add_dependency(%q<mail>, ["~> 2.6"])
53
+ s.add_dependency(%q<savon>, ["~> 2.10"])
57
54
  s.add_dependency(%q<bundler>, ["~> 1.0"])
58
55
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
59
- s.add_dependency(%q<simplecov>, [">= 0"])
60
- s.add_dependency(%q<savon>, ["~> 2.10"])
61
- s.add_dependency(%q<mail>, ["~> 2.6"])
62
56
  end
63
57
  else
64
- s.add_dependency(%q<shoulda>, [">= 0"])
65
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
58
+ s.add_dependency(%q<mail>, ["~> 2.6"])
59
+ s.add_dependency(%q<savon>, ["~> 2.10"])
66
60
  s.add_dependency(%q<bundler>, ["~> 1.0"])
67
61
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
68
- s.add_dependency(%q<simplecov>, [">= 0"])
69
- s.add_dependency(%q<savon>, ["~> 2.10"])
70
- s.add_dependency(%q<mail>, ["~> 2.6"])
71
62
  end
72
63
  end
73
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailarchiva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David John
@@ -11,33 +11,33 @@ cert_chain: []
11
11
  date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: shoulda
14
+ name: mail
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
19
+ version: '2.6'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '2.6'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: savon
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.12'
34
- type: :development
33
+ version: '2.10'
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.12'
40
+ version: '2.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,48 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
- - !ruby/object:Gem::Dependency
70
- name: simplecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: savon
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.10'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '2.10'
97
- - !ruby/object:Gem::Dependency
98
- name: mail
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '2.6'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '2.6'
111
69
  description: A gem to access the Mailarchiva API
112
70
  email: dj@dbjohn.com
113
71
  executables: []