andrewfun 0.0.4 → 0.0.8

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/andrewfun.rb +33 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba8c0313ca39c5b66d5b2a4427ee3999ccdb3933ed1df8c7524718cbe8ec2ed0
4
- data.tar.gz: d49b8d083a48d7edf75c31fec1f7bc8eaa52872c60be40a4df19f5a6f95be868
3
+ metadata.gz: 25aefee29f224228469eee22d4555a8fb1142ad226e0e84c2b486c0c9704c0ce
4
+ data.tar.gz: 7292a676ed0c6331e357d09ad49423a5e78fd3cfad7fea7f0920852354d123b5
5
5
  SHA512:
6
- metadata.gz: f6f063018346e18012a6537f170199466a0a09e6e8f1829b3251245c0a3d58d51f1702e43d5fe7a61e8913e16c6b688a3d702b612fff76e75645173e23f35f1c
7
- data.tar.gz: 116d2a19b4ab7fd0631d281709b19540ca4d17e525651635a67571d5b44a753ff46c3d2c6b0ad164a7bb5b0f754e4a86289b05cbfff8f7a7219ed00c0e96db4a
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
- parsedIpData = JSON.parse(realIpData)
16
+ puts "there"
17
+ puts realIpData
18
+ parsedIpData = JSON.parse(realIpData.body)
13
19
  ip = parsedIpData["ip"]
14
20
  end
15
- token = request.headers["HTTP_TOKEN"]
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andrewfun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - andrew van beek