client-api 0.3.9 → 0.4.0

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: 7226fe17e3d771738d7d0c3a658ca186ff49736fd195228e266816a0e0959761
4
- data.tar.gz: c25f29df1e2b395404de270e5648ff2d532591e41afdd3ca7b1beefac9ddca0f
3
+ metadata.gz: 780ceea69d4b1d71a766c1c828d3d327259409e5f1e12d15d2d27ae32d8ae1d1
4
+ data.tar.gz: c69bc06b95bd0725d5abd65f253614e0bdbf7857e17ff80c4aafcb83c157f285
5
5
  SHA512:
6
- metadata.gz: 77861a5f4db0702bf9e98f76d1d4217da6909f5b66dd590fbd1e880300a3ebe2fa8e186d76edad21123d7152bc563dcab8cfed5f7a326c9f5b5db0b6dac4137e
7
- data.tar.gz: 39f64ca08d0b643a9ead2ed2bf1727406c811e821891a2b65e7af598e3736c6f3402bf558ab4722f110448f42198dd3b27be83ac9db07bc41d51b415f413ed5b
6
+ metadata.gz: b3fcd32572759841adffa45167742d06e02e05f762c640f6d11adb6e308732e31390fc9dbdf4305af4049bd471864873ed3b47d40dfc7fbedbc22822cab70883
7
+ data.tar.gz: 808ec7c1ca0cf1b0356f4e5760c49c506a893a26d06e95fe657ef92a8c0ddb627ecbbbd19d0149eabd38be3c43490f43fb19c4744abd9756b3df1fd55edc2136
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module ClientApi
2
- VERSION = "0.3.9".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prashanth Sams