Class: Foursquared::Response::Badge
- Inherits:
-
Object
- Object
- Foursquared::Response::Badge
- Defined in:
- lib/foursquared/response/badge.rb
Overview
Badge response
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#badge_id ⇒ String
Canonical id of the badge.
-
#badge_text ⇒ String
Text for the badge.
-
#description ⇒ String
The badge description.
-
#hint ⇒ String
Hint about the badge.
-
#id ⇒ String
The badge’s id.
-
#image ⇒ Hash
The badge image details.
-
#initialize(client, response) ⇒ Badge
constructor
A new instance of Badge.
-
#level ⇒ Integer
The currently unlocked level.
-
#level_text ⇒ String
Text about the level unlocked.
-
#name ⇒ String
The name of the badge.
-
#unlock_message ⇒ String
The message to be shown when user unlocks the badge.
-
#unlocks ⇒ Array
An array of unlock data.
Constructor Details
#initialize(client, response) ⇒ Badge
Returns a new instance of Badge.
6 7 8 9 |
# File 'lib/foursquared/response/badge.rb', line 6 def initialize client, response @client = client @response = response end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/foursquared/response/badge.rb', line 5 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/foursquared/response/badge.rb', line 5 def response @response end |
Instance Method Details
#badge_id ⇒ String
Canonical id of the badge
19 20 21 |
# File 'lib/foursquared/response/badge.rb', line 19 def badge_id response["badgeId"] end |
#badge_text ⇒ String
Text for the badge
55 56 57 |
# File 'lib/foursquared/response/badge.rb', line 55 def badge_text response["badgeText"] end |
#description ⇒ String
The badge description
49 50 51 |
# File 'lib/foursquared/response/badge.rb', line 49 def description response["description"] end |
#hint ⇒ String
Hint about the badge
61 62 63 |
# File 'lib/foursquared/response/badge.rb', line 61 def hint response["hint"] end |
#id ⇒ String
The badge’s id
13 14 15 |
# File 'lib/foursquared/response/badge.rb', line 13 def id response["id"] end |
#image ⇒ Hash
The badge image details
67 68 69 |
# File 'lib/foursquared/response/badge.rb', line 67 def image response["image"] end |
#level ⇒ Integer
The currently unlocked level
31 32 33 |
# File 'lib/foursquared/response/badge.rb', line 31 def level response["level"] end |
#level_text ⇒ String
Text about the level unlocked
37 38 39 |
# File 'lib/foursquared/response/badge.rb', line 37 def level_text response["responseText"] end |
#name ⇒ String
The name of the badge
25 26 27 |
# File 'lib/foursquared/response/badge.rb', line 25 def name response["name"] end |
#unlock_message ⇒ String
The message to be shown when user unlocks the badge
43 44 45 |
# File 'lib/foursquared/response/badge.rb', line 43 def response["unlockMessage"] end |
#unlocks ⇒ Array
An array of unlock data
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/foursquared/response/badge.rb', line 73 def unlocks @unlocks = response["unlocks"] if @unlocks @unlocks.each do |unlock| if unlock["checkins"] unlock["checkins"].map!{|checkin| Foursquared::Response::Checkin.new(client, checkin)} end end end @unlocks end |