basic_url 0.1.1 → 0.2.2

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: be84b8bb5353da46b35407db67e54884c44f0d67a8be8fddd554523fbe2ea82e
4
+ data.tar.gz: 476ed3e5a183b7b4238dc80b4dffc93b49f7c131e96a90ba3aa713a9ffcfcabd
5
5
  SHA512:
6
- metadata.gz: faa9b663146901b711854535d862218f3d3fa75b08d10c2b0bc0a4d54c38b731aa917ad9f558555df1ac9fa1f3604df45a7a057fcbb3c7f1bb85d59835bc5ed3
7
- data.tar.gz: 0f292a5a51c9ffb75cb451417e590fd6a339c350127058b046f9c6038b25fb49855b4f87cfa686504bb9d3987faef9fb8f4fb7a24fc3f2a65b3ee030296e84f0
6
+ metadata.gz: 51eb3cfad155938b9ec508c04ff53ce4e45b896229bbe5d2ab9831f3248c21ff0e088ddb80b0d329a55d73facdcf7e099f8c9bf9e628daca7756d341d57a8ac9
7
+ data.tar.gz: 20015e7542af3bb1081fe440aad59431ebb907aa2f36557d62f9f7d16dab21577b508a35562752d46f4eaa7c3d3bf7d3579e4ea32f1e5a0d4687bdffdb0fbaca
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.2 f983bfb8f93cc670be8777dd9cc722cc3f5562b4
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/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.2
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-03-25 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