url_common 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/url_common/version.rb +1 -1
- data/lib/url_common.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf016ee73428bc8dc46afb13ddf8aa1e21840650e38ac0b6c03d91c69453afca
|
4
|
+
data.tar.gz: '098c5fcaa13ee7bf0b390bfae0af56784ed25547d7b0946591c2619344f004ca'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 780507307f3b1c6745cddba4eeb37cbad88a623c8b6f694a51798c0347d80db5fffbc2210ffafe0b272e270ecc48bf036c35c7071384a656bcf0b0ca30cdc791
|
7
|
+
data.tar.gz: bd449bfe93ecdfe735c947c8d6caba91962493778cbfe899cc456a5f056db2102c3ff208084f3fbd3ce47b3383c4046d3a1c4a6c5a5504e6974a81e9b809d0cd
|
data/Gemfile.lock
CHANGED
data/lib/url_common/version.rb
CHANGED
data/lib/url_common.rb
CHANGED
@@ -542,5 +542,26 @@ module UrlCommon
|
|
542
542
|
|
543
543
|
return UrlCommon.select_best_rssurl_from_rssurls(results)
|
544
544
|
end
|
545
|
+
|
546
|
+
#based on this approach: https://medium.com/@sparkboldstudio/building-a-url-shortener-rails-app-96db60d3bf9d
|
547
|
+
#def self.generate_short_fid
|
548
|
+
#def self.create_fid
|
549
|
+
def self.generate_fid
|
550
|
+
rand(36**8).to_s(36)
|
551
|
+
end
|
552
|
+
|
553
|
+
def self.sanitize(long_url, url_base)
|
554
|
+
long_url.strip!
|
555
|
+
sanitize_url = self.long_url.downcase.gsub(/(https?:\/\/)|(www\.)/,"")
|
556
|
+
#"http://#{sanitize_url}"
|
557
|
+
url_base + sanitize_url
|
558
|
+
end
|
559
|
+
|
560
|
+
# todo expand on this by checking to make sure it doesn't call again
|
561
|
+
# should be fine but ttfn
|
562
|
+
def self.create_permalink(tbl, fld, url)
|
563
|
+
short_url = UrlCommon.generate_short_url
|
564
|
+
sanitized_url = UrlCommon.sanitize(url, "https://pullquotes.io/pull_quotes/")
|
565
|
+
end
|
545
566
|
|
546
567
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: url_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fuzzyurl
|