ifconfig-ruby 0.0.2
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 +7 -0
- data/lib/ifconfig.rb +20 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc8c9f2a0cda99e867f5f1ecb9320555e4e8331f9d279847a0060f24b01ef1f7
|
4
|
+
data.tar.gz: 2a7d1a5eff9c6f6c279deba6f6dde216a17b6efe5db4a6019470f4e75dcfb715
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 314be4d3709ff020b5ca0b8ab7f3b89f16ca8742f00565bddf3c722071942d15a4a7dad535ba49f09670f49af88dceee74ffcca0829d28f2c9ce71e7e32c44ba
|
7
|
+
data.tar.gz: 32cf6461b5138cc375e8158e5ec8c109a0850cdfc394e782e73af600ad7177987e47098eefd52b71327c1460c21d1d1d75135b20197ec565b5a54ca15177812e
|
data/lib/ifconfig.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
retries = 0
|
5
|
+
|
6
|
+
class IFConfig
|
7
|
+
def self.myip
|
8
|
+
begin
|
9
|
+
output = JSON.parse(Net::HTTP.get('lumtest.com', '/myip.json'))
|
10
|
+
rescue
|
11
|
+
if (retries += 1) <= 4
|
12
|
+
sleep(1)
|
13
|
+
retry
|
14
|
+
else
|
15
|
+
raise
|
16
|
+
end
|
17
|
+
end
|
18
|
+
return output["ip"]
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ifconfig-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Chua
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-11-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A quick way to get your rails instance's ipaddress as seen by the outside
|
14
|
+
world
|
15
|
+
email: zhchua@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/ifconfig.rb
|
21
|
+
homepage: https://rubygems.org/gems/ifconfig-ruby
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubygems_version: 3.0.3.1
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: A quick way to get your rails instance's ipaddress as seen by the outside
|
44
|
+
world
|
45
|
+
test_files: []
|