dont-overstay 0.0.2 → 0.0.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 +4 -4
- data/lib/dont-overstay.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f53e5a7b3ed6677253673996eccf4da5e448e4d
|
|
4
|
+
data.tar.gz: d99a92c088459347b7cfafb7015dbbe31fecfbf2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2f6955788574e3da2d43f5271c493528f86b8b1dd00cf1a606b094e80c39da046f5653f60286fbc2e35ef03142997a029c2bea95d3165a528956e34c9fc30aa
|
|
7
|
+
data.tar.gz: 3d8e5a625b656cd4d00221a32ee7b5da5e513976d4e5c57a49493ac2691bed7f1172f7270855176a383a945e743d2a21c0bf468f5b7413546801168d9ec38a2f
|
data/lib/dont-overstay.rb
CHANGED
|
@@ -24,6 +24,9 @@ class Daytracker
|
|
|
24
24
|
requested_url = @full_url + '&afterTimestamp=' + after.to_s + '&beforeTimestamp=' + before.to_s
|
|
25
25
|
after_timestamp = after
|
|
26
26
|
before_timestamp = before
|
|
27
|
+
last_country_code = ""
|
|
28
|
+
last_country_name = ""
|
|
29
|
+
|
|
27
30
|
begin
|
|
28
31
|
while (after_timestamp + 3600) < Time.now.to_i
|
|
29
32
|
requested_url = @full_url + '&afterTimestamp=' + after_timestamp.to_s + '&beforeTimestamp=' + before_timestamp.to_s
|
|
@@ -50,11 +53,8 @@ class Daytracker
|
|
|
50
53
|
end
|
|
51
54
|
end
|
|
52
55
|
after_timestamp = checkin["createdAt"].to_i + 1800 # Set the createdAt to after Timestamp
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
#puts country_list.inspect
|
|
56
|
-
#puts checkin["venue"]["location"]["country"]
|
|
57
|
-
#puts "---"
|
|
56
|
+
last_country_code = checkin["venue"]["location"]["cc"].to_s
|
|
57
|
+
last_country_name = checkin["venue"]["location"]["country"].to_s
|
|
58
58
|
}
|
|
59
59
|
if checkins.length == 0 then
|
|
60
60
|
after_timestamp += 1800
|
|
@@ -72,7 +72,8 @@ class Daytracker
|
|
|
72
72
|
rescue
|
|
73
73
|
{:status => "Exception found #{$!}"}
|
|
74
74
|
end
|
|
75
|
-
|
|
75
|
+
days_since_last_ts = (Time.now.to_i - after_timestamp.to_i) / 86400
|
|
76
|
+
{:status => "OK", countries: country_list, last_seen: {days: days_since_last_ts, country: {code: last_country_code, name: last_country_name}}}
|
|
76
77
|
else
|
|
77
78
|
{:status => "Before time is too soon"}
|
|
78
79
|
end
|