mailosaur 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailosaur.rb +3 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 958bed120db8df13a226f1f8cbfb58c0b6675d3f
4
- data.tar.gz: 2339ed43752ac88db945241349114715dd722f0a
3
+ metadata.gz: ea931c7acc82710e2afbaae5cf7ad36439c5525c
4
+ data.tar.gz: 7b7e5bfa048fea91faec81454139de505f3aca42
5
5
  SHA512:
6
- metadata.gz: 7ad786ad1421004232b750c89b6645f4ea9e53b66ede0fef35d6b8f988640c91e813ca3985a4145451043a740d55f5d081b3ca6851ee0dfb06dfc7625a4799f8
7
- data.tar.gz: 89117a52e1f693a10824314ee6f6725aa7dcc1ff35809ac61bdf0f28684b1ae5df9df81ac71488683ed521a641383ce257efe62d73f638b61777c4691f9d0eee
6
+ metadata.gz: fc86c1dea69f23b7f35ba31f588a41e916d7c9179e11aa19168f9afd29cc4dfec31a0a96c04e9642ab44e32211f1e84164958efb74141f07f3f0efff8f27f606
7
+ data.tar.gz: 7cc8f19468546ee137858d705a6430d085500f506cf0bc23aba44af9203f84b451e8182d30b2cc72193d153115ac56a254d87b4b0302ea3d8f1f10d067469129
@@ -3,10 +3,9 @@ require_relative 'helper.rb'
3
3
  class Mailosaur
4
4
  attr_reader :message
5
5
 
6
- def initialize(mailbox, apiKey, timeout=20)
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
- r = ''
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.1.1
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-09 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json