Class: Foursquared::Response::Badge

Inherits:
Object
  • Object
show all
Defined in:
lib/foursquared/response/badge.rb

Overview

Badge response

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/foursquared/response/badge.rb', line 5

def client
  @client
end

#responseObject (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_idString

Canonical id of the badge

Returns:

  • (String)


19
20
21
# File 'lib/foursquared/response/badge.rb', line 19

def badge_id
  response["badgeId"]
end

#badge_textString

Text for the badge

Returns:

  • (String)


55
56
57
# File 'lib/foursquared/response/badge.rb', line 55

def badge_text
  response["badgeText"]
end

#descriptionString

The badge description

Returns:

  • (String)


49
50
51
# File 'lib/foursquared/response/badge.rb', line 49

def description
  response["description"]
end

#hintString

Hint about the badge

Returns:

  • (String)


61
62
63
# File 'lib/foursquared/response/badge.rb', line 61

def hint
  response["hint"]
end

#idString

The badge’s id

Returns:

  • (String)


13
14
15
# File 'lib/foursquared/response/badge.rb', line 13

def id
  response["id"]
end

#imageHash

The badge image details

Returns:

  • (Hash)


67
68
69
# File 'lib/foursquared/response/badge.rb', line 67

def image
  response["image"]
end

#levelInteger

The currently unlocked level

Returns:

  • (Integer)


31
32
33
# File 'lib/foursquared/response/badge.rb', line 31

def level
  response["level"]
end

#level_textString

Text about the level unlocked

Returns:

  • (String)


37
38
39
# File 'lib/foursquared/response/badge.rb', line 37

def level_text
  response["responseText"]
end

#nameString

The name of the badge

Returns:

  • (String)


25
26
27
# File 'lib/foursquared/response/badge.rb', line 25

def name
  response["name"]
end

#unlock_messageString

The message to be shown when user unlocks the badge

Returns:

  • (String)


43
44
45
# File 'lib/foursquared/response/badge.rb', line 43

def unlock_message
  response["unlockMessage"]
end

#unlocksArray

An array of unlock data

Returns:

  • (Array)


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