iri 0.7.0 → 0.8.0

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: 564c361b6ff96ad33b06d606342683aeab545505bb5baf8f2ba7c34da333a7d5
4
- data.tar.gz: b337674a82e1d37852642d793546cebfd1776cd855ee62b12f9bec5d4d92d77c
3
+ metadata.gz: 6f999bd94bb431514584216e518edd721ce449e2af0f7cc4921073bc0b3d33a2
4
+ data.tar.gz: 8b73e9a02dadc087f7024ccc020ce3a1f1e6f816a612edaca4fb4fa92507db24
5
5
  SHA512:
6
- metadata.gz: 80de9feb3d57cb52b62c67af835b7dc0c98e4d83917fd9916940892e0fdf599038a3e0dd8f4ff36fe7e09489b159210dcc830f9df1b96b3b135edafed8f05335
7
- data.tar.gz: c3052e3ea6c3fa4e3fcfa4cd4986c0374a59157adbd7d1a34b4981e5ef175e4e9f37e87652fd593aa4390325995ef3f77b10369cb13a21b2bc1b204e66d4ef1b
6
+ metadata.gz: 35accdc23c65209ca3436dfa04cb6d026e745fd0d9a4893f7ad4683ba80ef06da5e7a54d8918fb4db7e0692c9e44384d0a606ee09b4186c038f517e83695ea5e
7
+ data.tar.gz: c74f2a7818bc367b283fe39e16a721525cd080fdd5f56c348fb52244b92273ef2e66d19e2bee71310453731c75605f6b3de3529abd2f15a2e9b2d3b1e80057b3
@@ -8,13 +8,13 @@ jobs:
8
8
  codecov:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/checkout@v3
11
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
12
12
  - uses: ruby/setup-ruby@v1
13
13
  with:
14
14
  ruby-version: 2.7
15
15
  - run: bundle update
16
16
  - run: bundle exec rake
17
- - uses: codecov/codecov-action@v3
17
+ - uses: codecov/codecov-action@v4.0.0-beta.3
18
18
  with:
19
19
  file: coverage/.resultset.json
20
20
  fail_ci_if_error: true
@@ -16,7 +16,7 @@ jobs:
16
16
  ruby: [2.7, 3.1]
17
17
  runs-on: ${{ matrix.os }}
18
18
  steps:
19
- - uses: actions/checkout@v3
19
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
20
20
  - uses: ruby/setup-ruby@v1
21
21
  with:
22
22
  ruby-version: ${{ matrix.ruby }}
data/.rultor.yml CHANGED
@@ -1,11 +1,12 @@
1
1
  docker:
2
- image: yegor256/rultor-image:1.21.0
2
+ image: yegor256/rultor-image:1.22.0
3
3
  assets:
4
4
  rubygems.yml: yegor256/home#assets/rubygems.yml
5
5
  install: |-
6
6
  pdd -f /dev/null
7
- sudo bundle install --no-color "--gemfile=$(pwd)/Gemfile"
7
+ bundle install --no-color
8
8
  release:
9
+ pre: false
9
10
  script: |-
10
11
  [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
11
12
  bundle exec rake
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
3
+ # Copyright (c) 2019-2024 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -23,9 +23,9 @@
23
23
  source 'https://rubygems.org'
24
24
  gemspec
25
25
 
26
- gem 'minitest', '5.19.0', require: false
27
- gem 'rake', '13.0.6', require: false
28
- gem 'rdoc', '6.5.0', require: false
29
- gem 'rubocop', '1.56.0', require: false
30
- gem 'rubocop-rspec', '2.23.2', require: false
26
+ gem 'minitest', '5.20.0', require: false
27
+ gem 'rake', '13.1.0', require: false
28
+ gem 'rdoc', '6.6.2', require: false
29
+ gem 'rubocop', '1.59.0', require: false
30
+ gem 'rubocop-rspec', '2.25.0', require: false
31
31
  gem 'simplecov', '0.22.0', require: false
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019-2023 Yegor Bugayenko
3
+ Copyright (c) 2019-2024 Yegor Bugayenko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -10,7 +10,6 @@
10
10
  [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/iri/master/frames)
11
11
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/iri/blob/master/LICENSE.txt)
12
12
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/iri.svg)](https://codecov.io/github/yegor256/iri?branch=master)
13
- ![Lines of code](https://img.shields.io/tokei/lines/github/yegor256/iri)
14
13
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/iri)](https://hitsofcode.com/view/github/yegor256/iri)
15
14
 
16
15
  The class [`Iri`](https://www.rubydoc.info/github/yegor256/iri/master/Iri)
@@ -23,7 +22,7 @@ url = Iri.new('http://google.com/')
23
22
  .append('find').append('me') # -> http://google.com/find/me
24
23
  .add(q: 'books about OOP', limit: 50) # -> ?q=books+about+OOP&limit=50
25
24
  .del(:q) # remove this query parameter
26
- .del('limit') # remove this one too
25
+ .del('limit', 'speed') # also remove these two
27
26
  .over(q: 'books about tennis', limit: 10) # replace these params
28
27
  .scheme('https') # replace 'http' with 'https'
29
28
  .host('localhost') # replace the host name
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
3
+ # Copyright (c) 2019-2024 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/iri.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2019-2023 Yegor Bugayenko
5
+ # Copyright (c) 2019-2024 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
28
28
  s.required_ruby_version = '>=2.2'
29
29
  s.name = 'iri'
30
- s.version = '0.7.0'
30
+ s.version = '0.8.0'
31
31
  s.license = 'MIT'
32
32
  s.summary = 'Simple Immutable Ruby URI Builder'
33
33
  s.description = "Class Iri helps you build a URI and then modify its \
data/lib/iri.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2019-2023 Yegor Bugayenko
5
+ # Copyright (c) 2019-2024 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -42,12 +42,15 @@ require 'cgi'
42
42
  # {README}[https://github.com/yegor256/iri/blob/master/README.md] file.
43
43
  #
44
44
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
45
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
45
+ # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
46
46
  # License:: MIT
47
47
  class Iri
48
48
  # When URI is not valid.
49
49
  class InvalidURI < StandardError; end
50
50
 
51
+ # When .add(), .over(), or .del() arguments are not valid.
52
+ class InvalidArguments < StandardError; end
53
+
51
54
  # Makes a new object.
52
55
  #
53
56
  # You can even ignore the argument, which will produce an empty URI.
@@ -88,6 +91,7 @@ class Iri
88
91
  # Iri.new('https://google.com').del(:q).add(q: 'test')
89
92
  #
90
93
  def add(hash)
94
+ raise InvalidArguments unless hash.is_a?(Hash)
91
95
  modify_query do |params|
92
96
  hash.each do |k, v|
93
97
  params[k.to_s] = [] unless params[k.to_s]
@@ -115,6 +119,7 @@ class Iri
115
119
  # Iri.new('https://google.com?q=test').over(q: 'hey you!')
116
120
  #
117
121
  def over(hash)
122
+ raise InvalidArguments unless hash.is_a?(Hash)
118
123
  modify_query do |params|
119
124
  hash.each do |k, v|
120
125
  params[k.to_s] = [] unless params[k]
data/test/test__helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2019-2023 Yegor Bugayenko
3
+ # Copyright (c) 2019-2024 Yegor Bugayenko
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/test/test_iri.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # (The MIT License)
4
4
  #
5
- # Copyright (c) 2019-2023 Yegor Bugayenko
5
+ # Copyright (c) 2019-2024 Yegor Bugayenko
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ require_relative '../lib/iri'
27
27
 
28
28
  # Iri test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2019-2023 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2019-2024 Yegor Bugayenko
31
31
  # License:: MIT
32
32
  class IriTest < Minitest::Test
33
33
  def test_builds_uri
@@ -49,6 +49,18 @@ class IriTest < Minitest::Test
49
49
  end
50
50
  end
51
51
 
52
+ def test_incorrect_call_of_add
53
+ assert_raises Iri::InvalidArguments do
54
+ Iri.new('https://example.com/').add('hello5')
55
+ end
56
+ end
57
+
58
+ def test_incorrect_call_of_over
59
+ assert_raises Iri::InvalidArguments do
60
+ Iri.new('https://example5.com/').over('boom44')
61
+ end
62
+ end
63
+
52
64
  def test_broken_uri_in_safe_mode
53
65
  Iri.new('https://example.com/>>>').add(a: 1)
54
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-23 00:00:00.000000000 Z
11
+ date: 2024-01-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Class Iri helps you build a URI and then modify its parts via a simple
14
14
  immutable fluent interface. It always returns a new object instead of changing the
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  requirements: []
61
- rubygems_version: 3.2.15
61
+ rubygems_version: 3.4.10
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Simple Immutable Ruby URI Builder