trumail 2.0.0 → 2.0.1

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
  SHA256:
3
- metadata.gz: bc7bb7a2b7c657af3c267c2988b8846a73f4f4304727322f6c00a259861f88eb
4
- data.tar.gz: e1215fdc190b1fc949ee59a4089d1d92a051e86ee946d0486907c38090175d3f
3
+ metadata.gz: 36a6c7daf215b674252060568cb6a7b39b764d91f2c6498c9789ba438a433d68
4
+ data.tar.gz: ab8a9185bf2b0a9700b495ca92a73691cfea621bf02704471bade9ab8e9ca5ea
5
5
  SHA512:
6
- metadata.gz: 84d1c76e6601452c0ec763a9768ed64caec5361e04f950db2d72d6a20e3ca24f684234290eaa06245c8f98f358e28d20a2800769d31ba6ef0a88c600b77fa3c0
7
- data.tar.gz: d789e279171104499f720bf09ad6463c9fdd3865516cc8cb07c96dcd85af607305c986a22c6d44ec49b332dadd359011f7ed6560d1dfe7a5b4b14739cd947658
6
+ metadata.gz: a79769f82d3afbcbd73c7abfd85e5a8ef9f33e5e8f98d5eca2a34bffbe8e84a0ca6e527da656fa3638679fd73294ef4ee1d8e9a15e67aa0c42db50257f468e57
7
+ data.tar.gz: f31c807a791ee56df1b6c1945fce2e5f8ff3d6e03eb60ffabf747306bf999af1a14ffcbf04e5013cd22192ceec28306312a1e9925bf180ac425d6ff3965fc2c4
data/README.md CHANGED
@@ -39,13 +39,15 @@ lookup = Trumail::Lookup.verify('test@email.com', host: 'https://verifier.com',
39
39
  ```ruby
40
40
  lookup.url => 'https://api.trumail.io/v2/lookup/json?email=test@email.com'
41
41
  lookup.hash => { 'address' => 'test@email.com', 'catchAll' => true, ... }
42
+ lookup.success? => true
43
+ lookup.error? => false
42
44
 
43
45
  # Data Methods
44
46
  lookup.address => 'test@email.com'
45
47
  lookup.username => 'test'
46
48
  lookup.domain => 'email.com'
47
49
  lookup.md5_hash => '0065537cb732045561c0d23e859710f4'
48
- lookup.suggestion => ''
50
+ lookup.suggestion => nil
49
51
  lookup.catch_all? => true
50
52
  lookup.deliverable? => false
51
53
  lookup.disposable? => true
@@ -38,6 +38,14 @@ module Trumail
38
38
  "#{@host}/v2/lookups/#{@format}?email=#{@email}"
39
39
  end
40
40
 
41
+ def error?
42
+ !success?
43
+ end
44
+
45
+ def success?
46
+ @hash.key?('address')
47
+ end
48
+
41
49
  def address
42
50
  @hash['address']
43
51
  end
@@ -7,10 +7,11 @@ module Trumail
7
7
  class Xml < Trumail::Parser::Base
8
8
 
9
9
  def parse
10
- @hash = Ox.parse(@data).nodes.each_with_object({}) do |xml, memo|
11
- value = xml.nodes.first
12
- memo[xml.value] = eval(value) rescue value
13
- end
10
+ @hash = Ox.load(@data, mode: :hash_no_attrs)
11
+ .dig(:lookup)
12
+ .each_with_object({}) do |(key, val), hash|
13
+ hash[key.to_s] = eval(val) rescue val
14
+ end
14
15
  end
15
16
 
16
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trumail
4
- VERSION ||= '2.0.0'
4
+ VERSION ||= '2.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trumail
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez