prolenea 0.1.6 → 0.1.7
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 +4 -4
- data/README.md +2 -2
- data/bin/prolenea-client +10 -3
- data/lib/prolenea.rb +8 -3
- data/lib/prolenea/connection.rb +3 -0
- data/lib/prolenea/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f14e65123f0c90425e0dce900e0b77e848f9957f
|
4
|
+
data.tar.gz: 1682edbcb29dcb9497828cd20df667a7b3e8f447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf514838418638329181a70fa701c69eb2159deaf895c274e12594c1d007e84d2bbdecd5c0930a419b0bed4fcd4629528433c2d6570dadd4e52d7cc0a9a60041
|
7
|
+
data.tar.gz: 826ecd0918f98ad47fcebfb351040befb4315b8d38799645fc6ff2299bee8fc202379d279d7a76dcc15bb8b75cec36db004ed8c39fb0b50c333a1cd9e791f116
|
data/README.md
CHANGED
@@ -35,8 +35,8 @@ puts JSON.pretty_generate result
|
|
35
35
|
```javascript
|
36
36
|
{
|
37
37
|
"number": "2125551000",
|
38
|
-
"local_routing_number":
|
39
|
-
"ported_date":
|
38
|
+
"local_routing_number": "6465550000",
|
39
|
+
"ported_date": "2015-07-09T15:00:00-05:00",
|
40
40
|
"alternative_spid": null,
|
41
41
|
"alternative_spid_name": null,
|
42
42
|
"line_type": null,
|
data/bin/prolenea-client
CHANGED
@@ -17,6 +17,10 @@ OptionParser.new do |opts|
|
|
17
17
|
opts.on("-n", "--number Number", String, "Number to lookup") do |number|
|
18
18
|
options[:number] = number
|
19
19
|
end
|
20
|
+
|
21
|
+
opts.on("-c", "--console") do
|
22
|
+
options[:console] = true
|
23
|
+
end
|
20
24
|
end.parse!
|
21
25
|
|
22
26
|
begin
|
@@ -25,9 +29,12 @@ begin
|
|
25
29
|
|
26
30
|
Prolenea.connect config
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
if options[:console]
|
33
|
+
pry.binding
|
34
|
+
elsif number
|
35
|
+
result = Prolenea.lookup_number(number)
|
36
|
+
puts JSON.pretty_generate result
|
37
|
+
end
|
31
38
|
rescue ProleneaError => pe
|
32
39
|
STDERR.puts pe.message
|
33
40
|
STDERR.puts pe.backtrace.join("\n")
|
data/lib/prolenea.rb
CHANGED
@@ -9,13 +9,18 @@ require 'prolenea/middleware/prolenea_response_middleware'
|
|
9
9
|
module Prolenea
|
10
10
|
include Error
|
11
11
|
|
12
|
+
DEFAULT_TIMEOUT = 10
|
13
|
+
|
12
14
|
module ClassMethods
|
13
15
|
|
16
|
+
attr_accessor :default_timeout
|
17
|
+
|
14
18
|
def connection
|
15
|
-
@connection ? @connection : (raise ProleneaNoConnectionError)
|
19
|
+
@connection ? @connection : (raise ProleneaNoConnectionError.new({}), 'Connection is not setup')
|
16
20
|
end
|
17
21
|
|
18
22
|
def connect(config = {})
|
23
|
+
@default_timeout = config[:default_timeout] || DEFAULT_TIMEOUT
|
19
24
|
@connection = Connection.new(:uri => config[:uri])
|
20
25
|
end
|
21
26
|
|
@@ -23,10 +28,10 @@ module Prolenea
|
|
23
28
|
!@connection.nil?
|
24
29
|
end
|
25
30
|
|
26
|
-
def lookup_number(number)
|
31
|
+
def lookup_number(number, options = {})
|
27
32
|
params = {:dial => number}
|
28
33
|
|
29
|
-
response = self.connection.get '/', params
|
34
|
+
response = self.connection.get '/', params, options
|
30
35
|
|
31
36
|
response.env[:parsed_body]
|
32
37
|
rescue ProleneaError => pe
|
data/lib/prolenea/connection.rb
CHANGED
@@ -51,6 +51,9 @@ module Prolenea
|
|
51
51
|
request.body = params unless params.empty?
|
52
52
|
end
|
53
53
|
|
54
|
+
request.options[:timeout] = (options[:timeout] ? options[:timeout] : Prolenea.default_timeout)
|
55
|
+
request.options[:open_timeout] = (options[:open_timeout] ? options[:open_timeout] : Prolenea.default_timeout)
|
56
|
+
|
54
57
|
request
|
55
58
|
end
|
56
59
|
|
data/lib/prolenea/version.rb
CHANGED