client-api 0.3.9 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/client-api/request.rb +7 -0
- data/lib/client-api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 780ceea69d4b1d71a766c1c828d3d327259409e5f1e12d15d2d27ae32d8ae1d1
|
4
|
+
data.tar.gz: c69bc06b95bd0725d5abd65f253614e0bdbf7857e17ff80c4aafcb83c157f285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3fcd32572759841adffa45167742d06e02e05f762c640f6d11adb6e308732e31390fc9dbdf4305af4049bd471864873ed3b47d40dfc7fbedbc22822cab70883
|
7
|
+
data.tar.gz: 808ec7c1ca0cf1b0356f4e5760c49c506a893a26d06e95fe657ef92a8c0ddb627ecbbbd19d0149eabd38be3c43490f43fb19c4744abd9756b3df1fd55edc2136
|
data/lib/client-api/request.rb
CHANGED
@@ -84,10 +84,17 @@ module ClientApi
|
|
84
84
|
if (args.include? "http://") || (args.include? "https://")
|
85
85
|
URI.parse(args)
|
86
86
|
else
|
87
|
+
url_validator(args)
|
87
88
|
URI.parse(base_url + args)
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
92
|
+
def url_validator(args)
|
93
|
+
raise "Missing a slash '/' next to the base URL: #{base_url}" if (base_url[-1, 1] != '/') && (args[0] != '/')
|
94
|
+
raise "Remove a slash '/' next to the base URL: #{base_url}#{args}" if (base_url[-1, 1] == '/') && (args[0] == '/')
|
95
|
+
raise "Invalid (or) incomplete URL: #{base_url + args}" unless (['https://', 'http://'].any? { |e| (base_url + args).include? e })
|
96
|
+
end
|
97
|
+
|
91
98
|
def connect(args)
|
92
99
|
http = Net::HTTP.new(uri(args).host, uri(args).port)
|
93
100
|
|
data/lib/client-api/version.rb
CHANGED