client-api 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 780ceea69d4b1d71a766c1c828d3d327259409e5f1e12d15d2d27ae32d8ae1d1
4
- data.tar.gz: c69bc06b95bd0725d5abd65f253614e0bdbf7857e17ff80c4aafcb83c157f285
3
+ metadata.gz: 7dbb4f551116b506ceb54d6fc780d49925d855993468fe9f363560c8e33d680b
4
+ data.tar.gz: a09dd5b448b36f39808d6000175a64b7f991df7ba809290c914c3e4c78bb6b91
5
5
  SHA512:
6
- metadata.gz: b3fcd32572759841adffa45167742d06e02e05f762c640f6d11adb6e308732e31390fc9dbdf4305af4049bd471864873ed3b47d40dfc7fbedbc22822cab70883
7
- data.tar.gz: 808ec7c1ca0cf1b0356f4e5760c49c506a893a26d06e95fe657ef92a8c0ddb627ecbbbd19d0149eabd38be3c43490f43fb19c4744abd9756b3df1fd55edc2136
6
+ metadata.gz: 5de223dbb03a13dddec68f285461a6160e610437291286551de4a7bcedc0e9e40a3b265c8ef4947153bd7bb9734891b1eeb754df5d1ef11b346354702c48a45a
7
+ data.tar.gz: 3a374364537bd2636ea08940c8dc7bdd8dd946f47f7111920c7f944c838de0e3483e95bf09fdd5dceeb59c94780e06abb5bbd7a13edb39500a0188b907c5a57e
@@ -84,15 +84,21 @@ module ClientApi
84
84
  if (args.include? "http://") || (args.include? "https://")
85
85
  URI.parse(args)
86
86
  else
87
- url_validator(args)
87
+ base_url = base_url_definition(args)
88
88
  URI.parse(base_url + args)
89
89
  end
90
90
  end
91
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] == '/')
92
+ def base_url_definition(args)
95
93
  raise "Invalid (or) incomplete URL: #{base_url + args}" unless (['https://', 'http://'].any? { |e| (base_url + args).include? e })
94
+
95
+ if (base_url[-1, 1] == '/') && (args[0] == '/')
96
+ base_url.gsub(/\/$/, '')
97
+ elsif (base_url[-1, 1] != '/') && (args[0] != '/')
98
+ base_url.concat('', '/')
99
+ else
100
+ base_url
101
+ end
96
102
  end
97
103
 
98
104
  def connect(args)
@@ -1,3 +1,3 @@
1
1
  module ClientApi
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prashanth Sams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-06 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler