maildrop 0.1.0.pre → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maildrop.rb +2 -1
- data/lib/maildrop/http.rb +1 -1
- data/lib/maildrop/models/email.rb +10 -24
- data/lib/maildrop/models/mailbox.rb +16 -3
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2ba3c55371997589e6e2890e437480d95106406
|
4
|
+
data.tar.gz: 917e18e2a6d2576ed190c82c119b6f9c0a5a819e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d28fa8ae29b5a7a561f9cdb32d7c643a2bca0b93c1f11c8960c423c7fa9e9f3985e083ab3931187bb05aee56ac683e1215fdfa685a0b2bb48fcacaa5323005
|
7
|
+
data.tar.gz: c96c725959a5c763cef7a440f7ad0b413ba31959abcdcbfc3967d8c6f73ec52b2224a6fc9b16cd72cc006654db42518350901400cb541f4f634636f52fe27aec
|
data/lib/maildrop.rb
CHANGED
data/lib/maildrop/http.rb
CHANGED
@@ -1,37 +1,23 @@
|
|
1
1
|
module Maildrop::Models
|
2
2
|
class Email
|
3
|
-
|
4
|
-
|
5
|
-
def initialize(mailbox_name, data)
|
6
|
-
@id = find_id(data)
|
7
|
-
@date = find_date(data)
|
8
|
-
@sender = find_sender(data)
|
9
|
-
@subject = find_subject(data)
|
10
|
-
@mailbox_name = mailbox_name
|
11
|
-
end
|
12
|
-
|
13
|
-
def body
|
14
|
-
http = Maildrop::HTTP.new
|
15
|
-
http.get("#{@mailbox_name}/#{@id}/body") # TODO: remove maildrop header!
|
3
|
+
def initialize(data)
|
4
|
+
@mail = Mail.new(data['body'])
|
16
5
|
end
|
17
6
|
|
18
|
-
|
19
|
-
|
20
|
-
def find_id(data)
|
21
|
-
data.attr('data-id')
|
7
|
+
def sender
|
8
|
+
@mail.from.first
|
22
9
|
end
|
23
10
|
|
24
|
-
def
|
25
|
-
|
11
|
+
def subject
|
12
|
+
@mail.subject
|
26
13
|
end
|
27
14
|
|
28
|
-
def
|
29
|
-
|
15
|
+
def date
|
16
|
+
@mail.date
|
30
17
|
end
|
31
18
|
|
32
|
-
def
|
33
|
-
|
34
|
-
DateTime.parse(date_string)
|
19
|
+
def body
|
20
|
+
@mail.body.decoded
|
35
21
|
end
|
36
22
|
end
|
37
23
|
end
|
@@ -4,10 +4,23 @@ module Maildrop::Models
|
|
4
4
|
|
5
5
|
def initialize(name, data)
|
6
6
|
@name = name
|
7
|
-
emails =
|
8
|
-
@emails = emails.map do |
|
9
|
-
|
7
|
+
emails = JSON.parse(data)
|
8
|
+
@emails = emails.map do |email|
|
9
|
+
data = download_email(email['id'])
|
10
|
+
Maildrop::Models::Email.new(data)
|
10
11
|
end
|
11
12
|
end
|
13
|
+
|
14
|
+
def address
|
15
|
+
"#{name}@maildrop.cc"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def download_email(id)
|
21
|
+
http = Maildrop::HTTP.new
|
22
|
+
response = http.get("#{@name}/#{id}")
|
23
|
+
JSON.parse(response)
|
24
|
+
end
|
12
25
|
end
|
13
26
|
end
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maildrop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Melvin Lammerts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mail
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.6'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.6.4
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.6'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.6.4
|
13
33
|
description: Ruby interface to MailDrop for quick, disposable mailboxes.
|
14
34
|
email: hi@melvin.sh
|
15
35
|
executables: []
|
@@ -33,12 +53,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
53
|
requirements:
|
34
54
|
- - ">="
|
35
55
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
56
|
+
version: 2.0.0
|
37
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
58
|
requirements:
|
39
|
-
- - "
|
59
|
+
- - ">="
|
40
60
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
61
|
+
version: '0'
|
42
62
|
requirements: []
|
43
63
|
rubyforge_project:
|
44
64
|
rubygems_version: 2.6.6
|