mailosaur 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailosaur.rb +3 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea931c7acc82710e2afbaae5cf7ad36439c5525c
|
4
|
+
data.tar.gz: 7b7e5bfa048fea91faec81454139de505f3aca42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc86c1dea69f23b7f35ba31f588a41e916d7c9179e11aa19168f9afd29cc4dfec31a0a96c04e9642ab44e32211f1e84164958efb74141f07f3f0efff8f27f606
|
7
|
+
data.tar.gz: 7cc8f19468546ee137858d705a6430d085500f506cf0bc23aba44af9203f84b451e8182d30b2cc72193d153115ac56a254d87b4b0302ea3d8f1f10d067469129
|
data/lib/mailosaur.rb
CHANGED
@@ -3,10 +3,9 @@ require_relative 'helper.rb'
|
|
3
3
|
class Mailosaur
|
4
4
|
attr_reader :message
|
5
5
|
|
6
|
-
def initialize(mailbox, apiKey
|
6
|
+
def initialize(mailbox, apiKey)
|
7
7
|
@mailbox = ENV['MAILOSAUR_MAILBOX'] || mailbox
|
8
8
|
@api_key = ENV['MAILOSAUR_APIKEY'] || apiKey
|
9
|
-
@timeout = timeout
|
10
9
|
@base_uri = 'https://mailosaur.com/v2'
|
11
10
|
@message = MessageGenerator.new
|
12
11
|
end
|
@@ -19,7 +18,7 @@ class Mailosaur
|
|
19
18
|
search_criteria['key'] = @api_key
|
20
19
|
search_criteria['mailbox'] = @mailbox
|
21
20
|
response = send_get_emails_request(search_criteria)
|
22
|
-
if response.length > 2
|
21
|
+
if !response.nil? && response.length > 2
|
23
22
|
data = JSON.parse(response.body)
|
24
23
|
data.map { |em| Email.new(em) }
|
25
24
|
else
|
@@ -108,16 +107,6 @@ class Mailosaur
|
|
108
107
|
private
|
109
108
|
|
110
109
|
def send_get_emails_request(search_criteria)
|
111
|
-
|
112
|
-
begin
|
113
|
-
Timeout::timeout(@timeout) {
|
114
|
-
until r.length > 2 && !r.nil?
|
115
|
-
r = RestClient.get("#{@base_uri}/emails", {:params => search_criteria})
|
116
|
-
end
|
117
|
-
r
|
118
|
-
}
|
119
|
-
rescue Timeout::Error
|
120
|
-
''
|
121
|
-
end
|
110
|
+
RestClient.get("#{@base_uri}/emails", {:params => search_criteria})
|
122
111
|
end
|
123
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailosaur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clickity Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|