john-mayer 0.0.3 → 0.0.4

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 (2) hide show
  1. data/lib/foursquare/user.rb +17 -0
  2. metadata +3 -3
@@ -4,6 +4,11 @@ module Foursquare
4
4
  @foursquare, @json = foursquare, json
5
5
  end
6
6
 
7
+ def fetch
8
+ @json = @foursquare.get("users/#{id}")["user"]
9
+ self
10
+ end
11
+
7
12
  def id
8
13
  @json["id"]
9
14
  end
@@ -37,10 +42,12 @@ module Foursquare
37
42
  end
38
43
 
39
44
  def pings
45
+ fetch unless @json.has_key?("pings")
40
46
  @json["pings"]
41
47
  end
42
48
 
43
49
  def contact
50
+ fetch unless @json.has_key?("contact")
44
51
  @json["contact"]
45
52
  end
46
53
 
@@ -57,18 +64,22 @@ module Foursquare
57
64
  end
58
65
 
59
66
  def badge_count
67
+ fetch unless @json.has_key?("badges")
60
68
  @json["badges"]["count"]
61
69
  end
62
70
 
63
71
  def mayorships
72
+ fetch unless @json.has_key?("mayorships")
64
73
  @json["mayorships"]["items"]
65
74
  end
66
75
 
67
76
  def checkin_count
77
+ fetch unless @json.has_key?("checkins")
68
78
  @json["checkins"]["count"]
69
79
  end
70
80
 
71
81
  def last_checkin
82
+ fetch unless @json.has_key?("checkins")
72
83
  item = @json["checkins"]["items"].last
73
84
  Foursquare::Checkin.new(@foursquare, item)
74
85
  end
@@ -80,5 +91,11 @@ module Foursquare
80
91
  Foursquare::Checkin.new(@foursquare, checkin)
81
92
  end
82
93
  end
94
+
95
+ def friends
96
+ @foursquare.get("users/#{id}/friends")["friends"]["items"].map do |item|
97
+ Foursquare::User.new(@foursquare, item)
98
+ end
99
+ end
83
100
  end
84
101
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: john-mayer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Nakajima