andrewfun 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/andrewfun.rb +33 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25aefee29f224228469eee22d4555a8fb1142ad226e0e84c2b486c0c9704c0ce
|
4
|
+
data.tar.gz: 7292a676ed0c6331e357d09ad49423a5e78fd3cfad7fea7f0920852354d123b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97df2cc9792d30329a38d8ac6f8f3e9be84ed4a01011df86b92fedd0b108cc4a13b7005a7c1bfc775d7ea62232b744ae7a026025ba129326ef3931882925b064
|
7
|
+
data.tar.gz: f489d1a826e1720cb5988de881b8e817f16c4e6d9b4c184216007721c326e9d9fd2d51603d87e0142a26fa178477df408b65f61ca9e4b877604908aacdfeac33
|
data/lib/andrewfun.rb
CHANGED
@@ -6,15 +6,46 @@ class Andrewfun
|
|
6
6
|
response = HTTParty.get(url)
|
7
7
|
authorizationResponse = JSON.parse(response.body)
|
8
8
|
puts authorizationResponse["authorized"]
|
9
|
+
otp = request.headers["HTTP_OTP"]
|
10
|
+
humantoken = request.headers["HTTP_HUMANTOKEN"]
|
11
|
+
devicetoken = request.headers["HTTP_DEVICE_TOKEN"]
|
9
12
|
ip = request.remote_ip
|
10
13
|
if ip == "::1" || ip == "127.0.0.1"
|
14
|
+
puts "here"
|
11
15
|
realIpData = HTTParty.get("https://api.ipify.org?format=json")
|
12
|
-
|
16
|
+
puts "there"
|
17
|
+
puts realIpData
|
18
|
+
parsedIpData = JSON.parse(realIpData.body)
|
13
19
|
ip = parsedIpData["ip"]
|
14
20
|
end
|
15
|
-
|
21
|
+
possibletoken = request.headers["HTTP_TOKEN"].split("Bearer ")
|
22
|
+
token = request.headers["HTTP_TOKEN"] || possibletoken
|
23
|
+
headers = {
|
24
|
+
"method" => request.method,
|
25
|
+
"ip" => ip,
|
26
|
+
"token" => token,
|
27
|
+
"api" => request.original_url
|
28
|
+
}
|
29
|
+
|
30
|
+
if devicetoken != nil
|
31
|
+
headers["device_token"] = devicetoken
|
32
|
+
end
|
33
|
+
|
34
|
+
if otp != nil
|
35
|
+
headers["otp"] = otp
|
36
|
+
end
|
37
|
+
|
38
|
+
if humantoken != nil
|
39
|
+
headers["humantoken"] = humantoken
|
40
|
+
end
|
41
|
+
|
42
|
+
|
16
43
|
puts token
|
44
|
+
puts devicetoken
|
45
|
+
puts humantoken
|
46
|
+
puts otp
|
17
47
|
puts ip
|
48
|
+
puts headers
|
18
49
|
end
|
19
50
|
|
20
51
|
|