immosquare-constants 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c1d32b001fdccc8140c36c0e4691951071d4ec150cdf0de27b5e8dd4cafc581
4
- data.tar.gz: 411dc174017837158cd599ba20bf879dc2b8b5442e95088abe9f4698ceed8d51
3
+ metadata.gz: 2516ca9a9f09d6bd9050f27e88b64b1b00dfbfb8e071cc7d3212f8d5f25cc19e
4
+ data.tar.gz: d41821675b3fc25604cb7ed57f5ad68971eec7199392c164bf16a6134fdcbf5c
5
5
  SHA512:
6
- metadata.gz: a95088bad0aebedbfde0b0745bfc79013732bc82b36be715e7892f44f088742749764267b2a281ffc8dd19a3a9ecfbc447ce138ccca9fac73cafcf0de3665efe
7
- data.tar.gz: 69d3d3f8515bac2e7d01f823e88c877f52097f810ac6ee050cd4c34a0349be05fb2ddb3843f0a954cabfe194e90250d60964186a8b6e3447c58abd0c4dcff5ae
6
+ metadata.gz: c6d112eaf32e54fa1d6bb9e3a422d77416ff7452488961529579da39ce74447e4d1c7a0a10932aa8543a1d4197e660b0ef47ee71fb7a34b905ed3d313e0e13ce
7
+ data.tar.gz: c429c7f583c21fd6ec16ebac768b2b8db5baa2c6b80e60ececce79ea5485fb774fefb8b79fc22bdcce59fbd238d1c82dc90f8164b3a8cbd7a9b55f6527267a34
@@ -0,0 +1,34 @@
1
+ require "socket"
2
+ require "net/http"
3
+ require "uri"
4
+
5
+ module ImmosquareConstants
6
+ module Ip
7
+ class << self
8
+
9
+ ##============================================================##
10
+ ## On récupère l'IP réelle
11
+ ##============================================================##
12
+ def get_real_ip
13
+ begin
14
+ begin
15
+ uri = URI.parse("https://checkip.amazonaws.com/")
16
+ response = Net::HTTP.get_response(uri)
17
+ raise("No IP found") unless response.is_a?(Net::HTTPSuccess)
18
+
19
+ response.body.strip
20
+ rescue StandardError => e
21
+ s = Socket.ip_address_list.find(&:ipv4_private?)
22
+ s = Socket.ip_address_list.first if s.blank?
23
+ raise("No IP found") if s.blank?
24
+
25
+ s.ip_address
26
+ end
27
+ rescue StandardError => e
28
+ "0.0.0.0"
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,11 @@
1
+ module ImmosquareConstants
2
+ module Regex
3
+ class << self
4
+
5
+ def email
6
+ /\A[^@\s]+@[^@\s]+\z/
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ImmosquareConstants
2
- VERSION = "0.1.3".freeze
2
+ VERSION = "0.1.5".freeze
3
3
  end
@@ -1,5 +1,7 @@
1
- require "immosquare-constants/locale"
2
1
  require "immosquare-constants/color"
2
+ require "immosquare-constants/ip"
3
+ require "immosquare-constants/locale"
4
+ require "immosquare-constants/regex"
3
5
 
4
6
  module ImmosquareConstants
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-constants
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - IMMO SQUARE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-06 00:00:00.000000000 Z
11
+ date: 2024-09-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ImmosquareConstants gem provides a robust set of constants to facilitate
14
14
  application development across various domains
@@ -20,7 +20,9 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - lib/immosquare-constants.rb
22
22
  - lib/immosquare-constants/color.rb
23
+ - lib/immosquare-constants/ip.rb
23
24
  - lib/immosquare-constants/locale.rb
25
+ - lib/immosquare-constants/regex.rb
24
26
  - lib/immosquare-constants/version.rb
25
27
  homepage: https://github.com/IMMOSQUARE/immosquare-constants
26
28
  licenses:
@@ -41,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
43
  - !ruby/object:Gem::Version
42
44
  version: '0'
43
45
  requirements: []
44
- rubygems_version: 3.4.13
46
+ rubygems_version: 3.5.11
45
47
  signing_key:
46
48
  specification_version: 4
47
49
  summary: ImmosquareConstants is a comprehensive collection of constants useful for