mailinator 0.0.2 → 0.0.3

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: d8690ff90f8395b86a6d402890f6ceb30599162b
4
- data.tar.gz: 89925d6ba70a94e5552ceb1ef91baaf8c5d7bd46
3
+ metadata.gz: 7efcb76908b0e9f39c3555c0c0447a1f5ed36c01
4
+ data.tar.gz: 74d3502adfb850d8f1e1b6a965878ae7c637281b
5
5
  SHA512:
6
- metadata.gz: c16c2c51dcb449ff93ae34744b0051673d4603137191f8a68faa8f00d6ab54c010c36bf35f735de656f7551b412cf523cbd5171d21a693f58bfa10895f2079e4
7
- data.tar.gz: f2443a3b4861f8d147aeb9cd0be5acc2743c969e6023de6d9215467975aeba60ca95a5cdea5b53e883dd0646aede490c8799042eed9b2583a9a68fb4b3aaf206
6
+ metadata.gz: 77b2108f3a333285681ff4e58828b3470b4dcba9ab663d068e416c7a884baa8c6c278b705d2fc169cac54ebb9678111f6d23902bbd361b7db2dc54a54304a6ad
7
+ data.tar.gz: 097a2073cab6f220e2f650036f6d44c743db2e0537b09afd65d663832110e520b93126be84cd7b52828cb663803f8ca29950ac877f58536a0730d593347671cd
@@ -7,7 +7,7 @@ module Mailinator
7
7
  {
8
8
  id: @data['data']['id'],
9
9
  body: @data['data']['parts'].first['body'],
10
- body_html: @data['data']['parts'][1]['body'],
10
+ body_html: retrieve_body_html,
11
11
  inbox_fetches_left: @data['apiInboxFetchesLeft'],
12
12
  email_fetches_left: @data['apiEmailFetchesLeft'],
13
13
  forwards_left: @data['forwardsLeft'],
@@ -22,6 +22,13 @@ module Mailinator
22
22
  read?: @data['data']['been_read']
23
23
  }
24
24
  end
25
+
26
+ private
27
+
28
+ def retrieve_body_html
29
+ html = @data['data']['parts'][1] || {}
30
+ html['body']
31
+ end
25
32
  end
26
33
  end
27
34
  end
@@ -1,3 +1,3 @@
1
1
  module Mailinator
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -0,0 +1,5 @@
1
+ HTTP/1.1 200 OK
2
+ Server: Apache-Coyote/1.1
3
+ Date: Sun, 28 Dec 2014 13:39:51 GMT
4
+
5
+ {"apiInboxFetchesLeft":696,"apiEmailFetchesLeft":10,"data":{"headers":{"sender":"example@example.net","content-type":"multipart\/alternative;\r\n\tboundary=\"MIMEBoundaryec1dc8828d9bbedf095f9e9d2ebdbdeb\"","to":"recipient@mailinator.com","x-connecting-ip":"127.0.0.1","subject":"This is a subject","mime-version":"1.0","x-received-time":"1419696967076","reply-to":"example@example.net","received":"from 127-0-0-1.dynamic-ip.example.net ()\r\n by mail.mailinator.com with SMTP (Postfix)\r\n for recipient@mailinator.com;\r\n Sat, 27 Dec 2014 16:16:07 +0000 (UTC)","from":"\"Sender\" <example@example.net>","date":"Sun, 28 Dec 2014 00:16:00 +0800"},"seconds_ago":77024,"id":"1419696967-44152505-recipient","to":"recipient@mailinator.com","time":1419696967076,"subject":"This is a subject","fromfull":"example@example.net","parts":[{"headers":{"content-type":"text\/plain;\r\n\tcharset=\"iso-8859-1\"","content-transfer-encoding":"quoted-printable"},"body":"This is a body"}],"been_read":false,"from":"Sender","ip":"127.0.0.1"},"forwardsLeft":10}
@@ -26,4 +26,11 @@ describe Mailinator::Email do
26
26
  expect(message.forwards_left).to eq(10)
27
27
  expect(message.original).to be_a(Hash)
28
28
  end
29
+
30
+ it 'should return nil for #body_html when no html body' do
31
+ body = 'This is a body'
32
+ message = Mailinator::Email.get('abcd1234plain')
33
+ expect(message.body).to eq(body)
34
+ expect(message.body_html).to_not be
35
+ end
29
36
  end
@@ -15,6 +15,7 @@ end
15
15
 
16
16
  register_uri('https://api.mailinator.com/api/inbox?to=abcd1234&token=ABCD', 'inbox.response')
17
17
  register_uri('https://api.mailinator.com/api/email?msgid=abcd1234&token=ABCD', 'email.response')
18
+ register_uri('https://api.mailinator.com/api/email?msgid=abcd1234plain&token=ABCD', 'email-plain.response')
18
19
  register_uri('https://api.mailinator.com/api/email?msgid=1419696967-44152505-recipient&token=ABCD', 'email.response')
19
20
  register_uri('https://api.mailinator.com/api/not-found?token=ABCD', 'not-found.response')
20
21
  register_uri('https://api.mailinator.com/api/error?token=ABCD', 'error.response')
@@ -23,6 +24,7 @@ register_uri('https://api.mailinator.com/api/error?token=ABCD', 'error.response'
23
24
  # it replaces https:// to http://:443
24
25
  register_uri('http://api.mailinator.com:443/api/inbox?to=abcd1234&token=ABCD', 'inbox.response')
25
26
  register_uri('http://api.mailinator.com:443/api/email?msgid=abcd1234&token=ABCD', 'email.response')
27
+ register_uri('http://api.mailinator.com:443/api/email?msgid=abcd1234plain&token=ABCD', 'email-plain.response')
26
28
  register_uri('http://api.mailinator.com:443/api/email?msgid=1419696967-44152505-recipient&token=ABCD', 'email.response')
27
29
  register_uri('http://api.mailinator.com:443/api/not-found?token=ABCD', 'not-found.response')
28
30
  register_uri('http://api.mailinator.com:443/api/error?token=ABCD', 'error.response')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Dev.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-28 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -77,6 +77,7 @@ files:
77
77
  - lib/mailinator/models/inbox.rb
78
78
  - lib/mailinator/version.rb
79
79
  - mailinator.gemspec
80
+ - spec/fixtures/email-plain.response
80
81
  - spec/fixtures/email.response
81
82
  - spec/fixtures/error.response
82
83
  - spec/fixtures/inbox.response
@@ -114,6 +115,7 @@ signing_key:
114
115
  specification_version: 4
115
116
  summary: Mailinator REST API wrapper
116
117
  test_files:
118
+ - spec/fixtures/email-plain.response
117
119
  - spec/fixtures/email.response
118
120
  - spec/fixtures/error.response
119
121
  - spec/fixtures/inbox.response