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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dont-overstay.rb +7 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fecd3eca9860702512068c85514cfd5ef3b1551
4
- data.tar.gz: 01bc5589303d725ad5d10199d7a8924f473a3845
3
+ metadata.gz: 9f53e5a7b3ed6677253673996eccf4da5e448e4d
4
+ data.tar.gz: d99a92c088459347b7cfafb7015dbbe31fecfbf2
5
5
  SHA512:
6
- metadata.gz: bdf887195a69f0aa8a7e5f9ea2cf07075b5631a3a73002b78d77f89e66936bc69a8cf8f713a3484812b35b08f2cf1918c7be3c38b9e85e0da9a2dabce19c919e
7
- data.tar.gz: 66ade12b67578345967297b8f6ae6b3a079a5f28422b887dc3ef0edea3faa0078485b597f8d539a77870bc4bcca248e9cd41958c5999845528989c4f27aa79fd
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
- #puts checkin["createdAt"]
54
- #puts checkin["venue"]["location"]["cc"]
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
- {:status => "OK", countries: country_list}
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dont-overstay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Barry Teoh