trumail 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/trumail/lookup.rb +11 -7
- data/lib/trumail/version.rb +1 -1
- data/trumail.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0cb74da0efbcc6a10df33980752904d1da604d70033fc2d64e4f5377ec2c2194
|
4
|
+
data.tar.gz: 4207c818255761f16414cf51262a0fefb3f55530aaa9bd9a59c21a513d51dbba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99f2abf1eed00880a7802da867a03fe4c55a662dd3dbddab58de29e8a2ee4ef4fc491049541819d4798e484e0c5ef2200de5391f4b5aa7cacedfcb79d88f4fd1
|
7
|
+
data.tar.gz: 8c42fb15522c8fefb49d85078203ba09ce5b18918c579e988c68a27fc0a8a086db24a22295bf5fcad2b81f002b2c302a44413934c629a1c2aac68bc9e52c6db4
|
data/lib/trumail/lookup.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'typhoeus'
|
4
|
+
require 'user_agent_db'
|
4
5
|
|
5
6
|
module Trumail
|
6
7
|
class Lookup
|
@@ -8,7 +9,7 @@ module Trumail
|
|
8
9
|
DEFAULT_HOST ||= 'https://trumail.io'
|
9
10
|
DEFAULT_FORMAT ||= :json
|
10
11
|
|
11
|
-
attr_reader :email, :host, :format, :response
|
12
|
+
attr_reader :email, :hash, :host, :format, :response
|
12
13
|
|
13
14
|
def initialize(email, host: DEFAULT_HOST, format: DEFAULT_FORMAT)
|
14
15
|
@email = email
|
@@ -26,8 +27,11 @@ module Trumail
|
|
26
27
|
|
27
28
|
def verify
|
28
29
|
return @hash unless @response.nil?
|
29
|
-
|
30
|
-
|
30
|
+
|
31
|
+
Typhoeus::Config.user_agent = UserAgentDB.random
|
32
|
+
@response = Typhoeus.get(url, accept_encoding: 'gzip,deflate').response_body
|
33
|
+
|
34
|
+
parse_by_format
|
31
35
|
end
|
32
36
|
|
33
37
|
def url
|
@@ -79,10 +83,10 @@ module Trumail
|
|
79
83
|
def parse_by_format
|
80
84
|
return @hash if @response.nil?
|
81
85
|
|
82
|
-
case @format
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
+
@hash = case @format
|
87
|
+
when :json then Trumail::Parser::Json.parse(@response)
|
88
|
+
when :xml then Trumail::Parser::Xml.parse(@response)
|
89
|
+
end
|
86
90
|
end
|
87
91
|
|
88
92
|
end
|
data/lib/trumail/version.rb
CHANGED
data/trumail.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trumail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ox
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: user_agent_db
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
184
|
version: '0'
|
171
185
|
requirements: []
|
172
186
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
187
|
+
rubygems_version: 2.7.2
|
174
188
|
signing_key:
|
175
189
|
specification_version: 4
|
176
190
|
summary: Trumail Ruby SDK.
|