tanshuku 0.0.8 → 0.0.9

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: c4b9a3b20b2baf4c09ad35c5e10d00419ec7e3492f885b3cceb9cc129355f722
4
- data.tar.gz: f66396318dcb615cef25136c8e6206cf3b857ea4907cb0fb45f1195f4e53caf5
3
+ metadata.gz: aa7ab0b4cb36fafbd7747af1bff6592c5b775b9602bc664d84dbc195daa0ed3b
4
+ data.tar.gz: 1826f56d1be47b0925d2b5d05c5992f8218f499e02f6c049612e44f09e9a577b
5
5
  SHA512:
6
- metadata.gz: 02f976e4e5b3d24cbdb867eba134387f74b4050b65238d26a2307308b12ce55413fbe42fe95bfff68e3b25deca790eed20852ee50ea2069be2cbd0c8430aab38
7
- data.tar.gz: efaf9a395bab9c57a3cb985cc93f699c5f5c39dd8c776d23ebae71531b2a398044dd1c15c452bbbdeb988961b492179aa6fc821910dd71a65d03197182f0e80f
6
+ metadata.gz: 208cd3049977df30d0bd0757f5575414da55464b343f77f31e1d3195f8fd4377718b3d3c3067e0df6ff43fa198ef2c37666ffe9201e8242af465c90fc1108ead
7
+ data.tar.gz: 65d877e047853c97baef247b3508fe5a181d9ecf8d0696be491d6caf389bc9252ba155b6b465abe843c184e28300bca36c4b4a22695dfd5a04bc31b6a3b80bcf
@@ -9,7 +9,7 @@ require "securerandom"
9
9
  module Tanshuku
10
10
  class Url < ActiveRecord::Base
11
11
  MAX_URL_LENGTH = 10_000
12
- URL_PATTERN = %r{\A(?:https?:/)?/\w+}
12
+ URL_PATTERN = %r{\A(?:https?://\w+|/)}
13
13
  KEY_LENGTH = 20
14
14
 
15
15
  validates :url, :hashed_url, :key, presence: true
@@ -21,6 +21,8 @@ module Tanshuku
21
21
  # validates :url, :hashed_url, :key, uniqueness: true
22
22
 
23
23
  def self.shorten(original_url, retries: 0)
24
+ raise ArgumentError, "original_url should be present" unless original_url
25
+
24
26
  url = normalize_url(original_url)
25
27
 
26
28
  transaction do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tanshuku
4
- VERSION = "0.0.8"
4
+ VERSION = "0.0.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanshuku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - kg8m