quickemailverification 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32dcbf1542623a4c188f82b21f33a230f8e44016dcc00ab06ad7f10f07fcf55d
4
- data.tar.gz: 53f85e4016f00fbfc2e66c30ab879d1b9c466faaec28d97a35f452a309fb2866
3
+ metadata.gz: 42e1ef168a79708ab9828720f8949801646a5d70f04dbdb78cb036f4784b7457
4
+ data.tar.gz: 2bd0b0a352049365676daf77088419ecbe714e5960149ceedc0625656405d935
5
5
  SHA512:
6
- metadata.gz: d660971e48ebd1ccee8d5315da06d2cf40349282e3bb940895024d9f12964a4344360b1f26b943e384f96f87f1b440af5049769769cbe4ad8bfca1295a633c83
7
- data.tar.gz: e95334842139bccb22caa34a24155062678adcc72ae108852f0438da6d2fe9ab1b3cb917d5ea5d3a0a1d2fbfa7754b3b3aa0ab2c995ec403d92611eb7a84f412
6
+ metadata.gz: f52b7aaa94d0163c85f445ba73aa69fc72f5a8acbd504f6a030b6481d45ca3b41173e9a12b9c632a17cd32bd24edc082fc353f0535c2d003a85742b7093863b6
7
+ data.tar.gz: 0f0a7481a3279e8ff499f173bb8f3a8338087d1f35b5876146988d063496a8cfec926dcf0486ac933089a5d091339740ea7dc29e6a7cbea9e2aae01360a77d0a
@@ -22,6 +22,19 @@ module QuickEmailVerification
22
22
  @client.get("/verify?email=#{email}", body, options)
23
23
  end
24
24
 
25
+ # Return predefined response for predefined email address
26
+ #
27
+ # '/verify/sandbox?email=:email' GET
28
+ #
29
+ # email - send email address in query parameter
30
+ def sandbox(email, options = {})
31
+ body = options.fetch("query", {})
32
+
33
+ email = CGI::escape(email)
34
+
35
+ @client.get("/verify/sandbox?email=#{email}", body, options)
36
+ end
37
+
25
38
  end
26
39
 
27
40
  end
@@ -22,7 +22,7 @@ module QuickEmailVerification
22
22
  @options = {
23
23
  :base => "http://api.quickemailverification.com",
24
24
  :api_version => "v1",
25
- :user_agent => "quickemailverification-ruby/1.0.1 (https://github.com/quickemailverification/quickemailverification-ruby)"
25
+ :user_agent => "quickemailverification-ruby/1.0.2 (https://github.com/quickemailverification/quickemailverification-ruby)"
26
26
  }
27
27
 
28
28
  @options.update(options)
@@ -20,26 +20,28 @@ module QuickEmailVerification
20
20
  when 400...499
21
21
  body = QuickEmailVerification::HttpClient::ResponseHandler.get_body(env)
22
22
  message = ""
23
-
24
- # If HTML, whole body is taken
25
- if body.is_a?(String)
26
- message = body
27
- end
28
-
29
- # If JSON, a particular field is taken and used
30
- if type.include?("json") and body.is_a?(Hash)
31
- if body.has_key?("message")
32
- message = body["message"]
33
- else
34
- message = "Unable to select error message from json returned by request responsible for error"
35
- end
23
+ arrErrCode = [400, 401, 402, 403, 404, 429]
24
+ if !arrErrCode.include?(code)
25
+ # If HTML, whole body is taken
26
+ if body.is_a?(String)
27
+ message = body
28
+ end
29
+
30
+ # If JSON, a particular field is taken and used
31
+ if type.include?("json") and body.is_a?(Hash)
32
+ if body.has_key?("message")
33
+ message = body["message"]
34
+ else
35
+ message = "Unable to select error message from json returned by request responsible for error"
36
+ end
37
+ end
38
+
39
+ if message == ""
40
+ message = "Unable to understand the content type of response returned by request responsible for error"
41
+ end
42
+
43
+ raise QuickEmailVerification::Error::ClientError.new message, code
36
44
  end
37
-
38
- if message == ""
39
- message = "Unable to understand the content type of response returned by request responsible for error"
40
- end
41
-
42
- raise QuickEmailVerification::Error::ClientError.new message, code
43
45
  end
44
46
  end
45
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quickemailverification
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - QuickEmailVerification
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-05 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday