ruby_hlr_client 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/create_gem.txt +2 -0
- data/lib/ruby_hlr_client/hlr_client.rb +10 -3
- data/lib/ruby_hlr_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWM2ODVlYTQyNDg5ODQxMTgxMmIyNTU5YWJlOGRjMWQwY2I3MjI3Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTljYzM5OTdhOTJkYzZjYzJlNTVmMWJjNmVkN2E4NjNlNGZhZjdjYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjMxYWExNDA1MzJhNWNmNTY2MzU3MDA3NjYyNGRhYTg4NjY4NmUxMjhkYmM1
|
10
|
+
MWYxYzBhOGE3YmExMjI2OGE3OWQxYmY5ZmNlZjQyMzVlYjc0MmRhNjdjOTEy
|
11
|
+
NmUzYjhhMDY2NmY5NGQ2M2ZlMTI1MWQ2ZTU4ODU0MjY3NTY0YWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjRjY2QxYzQ5NWFiNGRkYTdjYTE1MjcyOTk3ZWExMjY0YWJlN2ZlMTk3MmUx
|
14
|
+
ZDgzNzQ2YWVmNGQ2NDY4N2EyOTcwODRkNzA1Mjc5ZTVjNzdjMjBmODY1N2Rj
|
15
|
+
M2QwMTJmNTY2MGVhNzc3MzcxYzMyMDllNTYyYmMyMjA0MDhiMmQ=
|
data/create_gem.txt
ADDED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rest_client'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module RubyHlrClient
|
4
5
|
|
@@ -12,7 +13,7 @@ module RubyHlrClient
|
|
12
13
|
def initialize(username, password, ssl = true)
|
13
14
|
@username = username
|
14
15
|
@password = password
|
15
|
-
@url = "#{ssl ? 'https' : 'http'}://www.
|
16
|
+
@url = "#{ssl ? 'https' : 'http'}://www.hlrd-lookups.com/api"
|
16
17
|
end
|
17
18
|
|
18
19
|
# Submits a synchronous HLR Lookup request. The HLR is queried in real time and results presented in the response body.
|
@@ -101,9 +102,14 @@ module RubyHlrClient
|
|
101
102
|
|
102
103
|
end
|
103
104
|
|
104
|
-
|
105
|
+
private
|
106
|
+
def send_request(query)
|
105
107
|
|
106
|
-
|
108
|
+
begin
|
109
|
+
response = RestClient.get @url, :params => query
|
110
|
+
rescue => e
|
111
|
+
return generate_error_result("HTTP Status Code #{e.message}")
|
112
|
+
end
|
107
113
|
|
108
114
|
unless response.code == 200
|
109
115
|
return generate_error_result("HTTP Status Code #{response.code}")
|
@@ -113,6 +119,7 @@ module RubyHlrClient
|
|
113
119
|
|
114
120
|
end
|
115
121
|
|
122
|
+
private
|
116
123
|
def generate_error_result(message)
|
117
124
|
|
118
125
|
{:success => false, :fieldErrors => [], :globalErrors => ["#{message}"]}.to_json
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_hlr_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Velocity Made Good Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- Rakefile
|
67
67
|
- bin/test_callback_handler.rb
|
68
68
|
- bin/test_client.rb
|
69
|
+
- create_gem.txt
|
69
70
|
- lib/ruby_hlr_client.rb
|
70
71
|
- lib/ruby_hlr_client/hlr_callback_handler.rb
|
71
72
|
- lib/ruby_hlr_client/hlr_client.rb
|