rails_url_shortener 0.2.2 → 0.2.3

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: 3d4a481aa504c85571a337b3fef38e9f7c5f6b498b18eb0dbb96cc19a28648a0
4
- data.tar.gz: 0d57d071fccde22b9855f47663a6737eecb1a9329b3c4dbdc553744bdbcaf5c7
3
+ metadata.gz: 5b57e818e54f05c9209a2534ec6e76d551252a6595a8e1f81354752d46cb4fcb
4
+ data.tar.gz: 9da77343ba94664263e077045f4cf42bbace11ca49a6c010a7267e0b48fc5ccd
5
5
  SHA512:
6
- metadata.gz: ce7e9633744aea66572207d0fd12ef5f75dd3a48044fa3dd0d9f3e3ed5b13fcc38fed290dad5f0a00da630fff903f4754dc77201de8e5d8f1243092a85a80260
7
- data.tar.gz: c400166ae93286517a6b5f876e431d034ae8e7ac6b293967671a0b75a99c3a0d7faa45fa9981ea35c871da9a0b40652249b1f9c7cdca591726cebba60d00844e
6
+ metadata.gz: 41b359b19b5d04a080f1081057b2fe90995a485ce537e33a5a543b71e2e01d8ebe3a2ac606bf6009927ec1a7d37db58c21631e3fd51206e0cacedde771f7bdbd
7
+ data.tar.gz: 72b1c6b431acc29a3050a25f0db5be0e651756c6e923027b708be1440cfc7dc335b0bd0ee3a5cf2dcaf19904c02e99e6723aaa0fb106bb56daae29f418a5ead6
@@ -11,12 +11,16 @@ module RailsUrlShortener
11
11
  # create or update an existing record information for an ip
12
12
 
13
13
  def perform(visit)
14
- if Ipgeo.exists?(ip: visit.ip) && Ipgeo.find_by(ip: visit.ip).updated_at <= Time.now - 3.months
15
- # Then update
16
- ip = HTTP.get("http://ip-api.com/json/#{visit.ip}?fields=status,message,country,countryCode,region,regionName,city,zip,lat,lon,timezone,isp,org,as,mobile,proxy,hosting,query")
17
- if ip.code == 200
18
- ipgeo = Ipgeo.find_by(ip: visit.ip)
19
- ipgeo.update(JSON.parse(ip.body).transform_keys { |key| key.to_s.underscore }.slice(*Ipgeo.column_names))
14
+ if Ipgeo.exists?(ip: visit.ip)
15
+ ipgeo = Ipgeo.find_by(ip: visit.ip)
16
+ if Ipgeo.find_by(ip: visit.ip).updated_at <= Time.now - 3.months
17
+ # Then update
18
+ ip = HTTP.get("http://ip-api.com/json/#{visit.ip}?fields=status,message,country,countryCode,region,regionName,city,zip,lat,lon,timezone,isp,org,as,mobile,proxy,hosting,query")
19
+ if ip.code == 200
20
+ ipgeo.update(JSON.parse(ip.body).transform_keys { |key| key.to_s.underscore }.slice(*Ipgeo.column_names))
21
+ visit.update(ipgeo: ipgeo)
22
+ end
23
+ else
20
24
  visit.update(ipgeo: ipgeo)
21
25
  end
22
26
  elsif !Ipgeo.exists?(ip: visit.ip)
@@ -1,3 +1,3 @@
1
1
  module RailsUrlShortener
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_url_shortener
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - a-chacon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-19 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -101,9 +101,9 @@ licenses:
101
101
  - GPL-3.0
102
102
  metadata:
103
103
  bug_tracker_uri: https://www.github.com/a-chacon/rails-url-shortener/issues
104
- changelog_uri: https://www.github.com/a-chacon/rails-url-shortener/releases/tag/v0.2.2
104
+ changelog_uri: https://www.github.com/a-chacon/rails-url-shortener/releases/tag/v0.2.3
105
105
  documentation_uri: https://github.com/a-chacon/rails-url-shortener/blob/main/README.md
106
- source_code_uri: https://github.com/a-chacon/rails-url-shortener/tree/v0.2.2
106
+ source_code_uri: https://github.com/a-chacon/rails-url-shortener/tree/v0.2.3
107
107
  rubygems_mfa_required: 'true'
108
108
  post_install_message:
109
109
  rdoc_options: []