tanshuku 0.0.5 → 0.0.7

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: 6a6b3fac0534882a8fdd68721d878ad3e44c2f66d47b08f0a768e4889303f1bd
4
- data.tar.gz: 8d6bb36e5809787459a3f2ece38ffc0a0421639c3bafc1b497862f9535ff9438
3
+ metadata.gz: 38d3ba69ba0a6432273e4fee3756e8d076e3bdbc72bcc46da8a94f5265b25fc1
4
+ data.tar.gz: 70c68e951bdf934317bec5ab150e439eaf4998bc4dfb5e55c6c4632ce0d80cdf
5
5
  SHA512:
6
- metadata.gz: 3312d4d55330281f9d692e66c5c55e7d7b0468028d19b913e2bcc9c7113377af998f90d916991fd755831099d68efff631ee3d69459d7ef5e43249618778187e
7
- data.tar.gz: 4ae5eb4b191af43eb7c35c1efefd58b23faeeb15991c18f610bae0ce51d9138de91f12076ffdd66d903d91918a7b810318f420df21db18e5e62c9137b3dedad9
6
+ metadata.gz: ae0b395952fb40de5d9afa799f61673f908ed3b72e31fb91804be8b9c9b804eaf9cc8d4d00680b9db27280b040879c920f15f54be8dd037dc5207761c12972f4
7
+ data.tar.gz: 60c89143f88f3bccaa7a3197ba5ff4231d8ac57021beef2ee913c853c7440efa9a89d8b0e8dc1393b8d5c19e8f388449f8149aeed3af3777057d88b63856f20f
@@ -41,6 +41,13 @@ module Tanshuku
41
41
  original_url
42
42
  end
43
43
 
44
+ def self.find_by_url(url)
45
+ normalized_url = normalize_url(url)
46
+ hashed_url = hash_url(normalized_url)
47
+
48
+ find_by(hashed_url:)
49
+ end
50
+
44
51
  # Normalize a trailing slash, `?` for an empty query, and so on, and sort query keys.
45
52
  def self.normalize_url(url)
46
53
  parsed_url = Addressable::URI.parse(url)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRailsUrlShortenerUrls < ActiveRecord::Migration[7.0]
3
+ class CreateTanshukuUrls < ActiveRecord::Migration[7.0]
4
4
  def change
5
5
  create_table :tanshuku_urls do |t|
6
6
  t.text :url, null: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tanshuku
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanshuku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kg8m
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-20 00:00:00.000000000 Z
11
+ date: 2023-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable