emailhunter 0.1.1 → 0.2.0

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: aa137bab379d7df31abcabb87843cd69d8f30d11
4
- data.tar.gz: b9adf893ea0b3d2945f5e49f4ff8e0bb0a163dff
3
+ metadata.gz: 0723ebdc178f2687eee958b64351bc18873f1117
4
+ data.tar.gz: deafc609522733f41b57f6439114c12040193335
5
5
  SHA512:
6
- metadata.gz: f51ebe40ecef58a40d65fc7a103e5bd13d48e15fe724b476ab930316031824cf7c3f39f8e2686935c8204adacd93de1a63879a8f6cafbe64b117c1b742d62c30
7
- data.tar.gz: a670bde8c08957bed0863258b1d1fd5d729005e11f53cba94e70e50195b6b4f33c9d14351e424c7ae6a8c4c6d353d319ee7c68e4abe7b3b8e66760d6f6a4dbfa
6
+ metadata.gz: aa49216254af99f397d0a3270f92972ba77788dce568a6f643d519c1c8f25bc0283ef01ae9a2b176cff0791efa1e82da7ecd323be186fa66c9734e840fe18108
7
+ data.tar.gz: 696e95c127acf06c427f9f3088828393e383cb4c1e0b25cf58d24a42807845103be077734147b891cd83168b9a0bf9fe80f809c0e37a307a52b80c048a9f3c43
@@ -15,7 +15,7 @@ module EmailHunter
15
15
 
16
16
  def hunt
17
17
  response = apiresponse
18
- OpenStruct.new(response) unless response.empty?
18
+ Struct.new(*response.keys).new(*response.values) unless response.empty?
19
19
  end
20
20
 
21
21
  private
@@ -23,7 +23,7 @@ module EmailHunter
23
23
  def apiresponse
24
24
  url = "#{API_EXISTS_URL}email=#{@email}&api_key=#{@key}"
25
25
  response = Faraday.get(URI.parse(URI.encode(url)))
26
- response.success? ? JSON.parse(response.body) : []
26
+ response.success? ? JSON.parse(response.body, {:symbolize_names => true}) : []
27
27
  end
28
28
  end
29
29
  end
@@ -8,14 +8,14 @@ module EmailHunter
8
8
  class Search
9
9
  attr_reader :status, :results, :emails
10
10
 
11
- def initialize(domain, key)
12
- @domain = domain
11
+ def initialize(domain, key)
12
+ @domain = domain
13
13
  @key = key
14
- end
14
+ end
15
15
 
16
16
  def hunt
17
17
  response = apiresponse
18
- OpenStruct.new(response) unless response.empty?
18
+ Struct.new(*response.keys).new(*response.values) unless response.empty?
19
19
  end
20
20
 
21
21
  private
@@ -23,7 +23,7 @@ module EmailHunter
23
23
  def apiresponse
24
24
  url = "#{API_SEARCH_URL}domain=#{@domain}&api_key=#{@key}"
25
25
  response = Faraday.get(URI.parse(URI.encode(url)))
26
- response.success? ? JSON.parse(response.body) : []
26
+ response.success? ? JSON.parse(response.body, {:symbolize_names => true}) : []
27
27
  end
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module EmailHunter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emailhunter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide Santangelo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-29 00:00:00.000000000 Z
11
+ date: 2015-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler