basic_url 0.1.1 → 0.2.4

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: 7f10e56f551ec196327c0a2976c49e36a68270ac1bfebee851cd1780916f61d7
4
- data.tar.gz: 26c1b5b16d7ced8dffc962fbaab4f332a3cb958a7f57dd1197e2a98d06e1cb8e
3
+ metadata.gz: 27695074c1075a7065b2b9ce8b18e7715a5fbbf226d453d16eebb921b695929c
4
+ data.tar.gz: 90f889f5e11a9b1726a13de003cd4aa9db644fb6b359ea8d783cf40d15e9b7cf
5
5
  SHA512:
6
- metadata.gz: faa9b663146901b711854535d862218f3d3fa75b08d10c2b0bc0a4d54c38b731aa917ad9f558555df1ac9fa1f3604df45a7a057fcbb3c7f1bb85d59835bc5ed3
7
- data.tar.gz: 0f292a5a51c9ffb75cb451417e590fd6a339c350127058b046f9c6038b25fb49855b4f87cfa686504bb9d3987faef9fb8f4fb7a24fc3f2a65b3ee030296e84f0
6
+ metadata.gz: 11ca7518910c67562fafc93fbe0263f9bca3fd91042c08b7fe0cf2077a232fab7cd77253dd2bcfb6a7dd10ea38a0ae6b4f80e9ff474375dccd56337f793a04e1
7
+ data.tar.gz: 7199ed13354aad1d5556dff5b78ab96466c8d0fff5f2d75bb569253727463564d8a1a16c811f98e192d5bf217e726598821be1eba900bb074959b0d05dd3ade9
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.2
2
+ TargetRubyVersion: 3.0
3
3
  NewCops: enable
4
4
  SuggestExtensions: false
5
5
 
data/.versions CHANGED
@@ -4,3 +4,5 @@
4
4
  # This file contains MAJOR.MINOR, PATCH is incremented by the build system to prevent overwriting tags.
5
5
  0.1.0 6ce56b44c6ba4e20f4b234a29ce9615d3e805ab0
6
6
  0.1.1 6c32353c8e1a8162c700b53a82582d020e1dda8b
7
+ 0.2.0 be51dcad202e7c1766b42d40de96f59d3fdd4535
8
+ 0.2.4 e55a6bbbc1b9d69c2a68eca83a1dac65d36d4c98
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  BasicUrl Changelog
2
2
  ==================
3
3
 
4
+ 0.2.0
5
+ -----
6
+
7
+ Add `enforce_trailing_path_slash` parameter to `.to_s`.
8
+
4
9
  0.1.0
5
10
  -----
6
11
 
data/README.md CHANGED
@@ -19,7 +19,7 @@ If you need full RFC compliance this gem is not suitable.
19
19
  ## Usage
20
20
 
21
21
  ```ruby
22
- require 'BasicURL'
22
+ require 'basic_url'
23
23
 
24
24
  base_url = BasicUrl.parse('192.0.2.64/api/v1', default_protocol: 'https')
25
25
 
@@ -57,6 +57,10 @@ controller.params = { key1: 'val1' }
57
57
  controller.params[:key2] = 'val2'
58
58
  puts controller.to_s
59
59
  # https://192.0.2.64/api/v1/some/controller?key1=val1&key2=val2
60
+
61
+ # Pass enforce_trailing_path_slash: true to to_s to always include a trailing / on the path parameter
62
+ puts base_url.to_s(enforce_trailing_path_slash: true)
63
+ # https://192.0.2.64/api/v1/
60
64
  ```
61
65
 
62
66
  ## Contributing
data/basic_url.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.summary = 'A Basic URL object that supports common URL operations'
9
9
  spec.description = 'Implements a simple URL object supporting object oriented paradigms, basic as-you-expect path joins, and native URLencoding.'
10
10
  spec.homepage = 'https://github.com/TJNII/basic_url'
11
- spec.required_ruby_version = '>= 3.2.0'
11
+ spec.required_ruby_version = '>= 3.0.0'
12
12
 
13
13
  # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
14
14
 
data/cicd/push_gem.sh CHANGED
@@ -6,5 +6,8 @@ set -euo pipefail
6
6
  out_version=$(./cicd/current_gem_version.sh)
7
7
  out_file="out/basic_url.$(./cicd/current_gem_version.sh).gem"
8
8
 
9
- gem push --otp "${out_file}"
9
+ echo "Enter Rubygems OTP code"
10
+ read otp
11
+
12
+ gem push "${out_file}" --otp "${otp}"
10
13
  git tag "${out_version}"
@@ -1,5 +1,5 @@
1
1
  # Licensed under the Apache 2 License
2
- # (C)2024 Tom Noonan II
2
+ # (C)2025 Tom Noonan II
3
3
 
4
4
  class BasicUrl
5
5
  module Errors
data/lib/basic_url.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Licensed under the Apache 2 License
2
- # (C)2024 Tom Noonan II
2
+ # (C)2025 Tom Noonan II
3
3
 
4
4
  require 'uri'
5
5
  require_relative 'basic_url/errors'
@@ -147,7 +147,7 @@ class BasicUrl
147
147
  return @path_components.map { |c| urlencode_component(c) }.join('/')
148
148
  end
149
149
 
150
- def to_s
150
+ def to_s(enforce_trailing_path_slash: false)
151
151
  %i[protocol host].each do |required_component|
152
152
  raise(Errors::InvalidURL, "Missing #{required_component}") unless send(required_component)
153
153
  end
@@ -162,6 +162,7 @@ class BasicUrl
162
162
  ret_val += host
163
163
  ret_val += ":#{port}" if port && port != _default_port_for_protocol(protocol: protocol)
164
164
  ret_val += "/#{path_encoded}" unless @path_components.empty?
165
+ ret_val += '/' if enforce_trailing_path_slash
165
166
  ret_val += _query_string unless params.empty?
166
167
  ret_val += "##{urlencode_component(fragment)}" if fragment
167
168
 
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basic_url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Noonan II
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-11 00:00:00.000000000 Z
11
+ date: 2025-04-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Implements a simple URL object supporting object oriented paradigms,
14
14
  basic as-you-expect path joins, and native URLencoding.
@@ -33,6 +33,7 @@ files:
33
33
  - cicd/push_gem.sh
34
34
  - lib/basic_url.rb
35
35
  - lib/basic_url/errors.rb
36
+ - out/basic_url.0.1.1.gem
36
37
  homepage: https://github.com/TJNII/basic_url
37
38
  licenses:
38
39
  - Apache-2.0
@@ -49,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
50
  requirements:
50
51
  - - ">="
51
52
  - !ruby/object:Gem::Version
52
- version: 3.2.0
53
+ version: 3.0.0
53
54
  required_rubygems_version: !ruby/object:Gem::Requirement
54
55
  requirements:
55
56
  - - ">="