Class: Foursquared::Response::Special

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

Overview

Special response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, response) ⇒ Special

Returns a new instance of Special.



7
8
9
10
# File 'lib/foursquared/response/special.rb', line 7

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/special.rb', line 5

def client
  @client
end

#responseObject (readonly)

Returns the value of attribute response.



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

def response
  @response
end

Instance Method Details

#descriptionString

A description of how to unlock the special.

Returns:

  • (String)


20
21
22
# File 'lib/foursquared/response/special.rb', line 20

def description
  response["description"]
end

#detailString

Minutes remaining until the special can be unlocked

Returns:

  • (String)


86
87
88
# File 'lib/foursquared/response/special.rb', line 86

def detail
  response["detail"]
end

#fine_printString

The specific rules for this special.

Returns:

  • (String)


110
111
112
# File 'lib/foursquared/response/special.rb', line 110

def fine_print
  response["finePrint"]
end

#flag(options = {}) ⇒ Object

Flag the Special

Parameters:

  • options (Hash) (defaults to: {})
  • option (Hash)

    a customizable set of options



125
126
127
# File 'lib/foursquared/response/special.rb', line 125

def flag options={}
  response = post("/specials/#{id}/flag", options)["response"]
end

#friends_hereArray<Foursquared::Response::User>

Friends who are here

Returns:



116
117
118
# File 'lib/foursquared/response/special.rb', line 116

def friends_here
  @friends = response["friendsHere"].collect{|friend| Foursquared::Response::User.new(client, friend)}
end

#iconString

The name of the icon to use

Returns:

  • (String)


50
51
52
# File 'lib/foursquared/response/special.rb', line 50

def icon
  response["icon"]
end

#icon_urlString

URL for the icon

Returns:

  • (String)


56
57
58
# File 'lib/foursquared/response/special.rb', line 56

def icon_url
  "http://foursquare.com/img/specials/#{icon}.png" if icon
end

#idString

ID of the special

Returns:

  • (String)


14
15
16
# File 'lib/foursquared/response/special.rb', line 14

def id
  response["id"]
end

#image_urlsHash

The count and urls for the images for the special

Returns:

  • (Hash)


38
39
40
# File 'lib/foursquared/response/special.rb', line 38

def image_urls
  response["imageUrls"]
end

#messageString

A message describing the special.

Returns:

  • (String)


32
33
34
# File 'lib/foursquared/response/special.rb', line 32

def message
  response["message"]
end

#progressInteger

A description of how close you are to unlocking the special

Returns:

  • (Integer)

    Either the number of people who have already unlocked the special (flash and swarm specials), or the number of your friends who have already checked in (friends specials)



74
75
76
# File 'lib/foursquared/response/special.rb', line 74

def progress
  response["progress"]
end

#progress_descriptionString

A label describing what the number in the progress field means.

Returns:

  • (String)


80
81
82
# File 'lib/foursquared/response/special.rb', line 80

def progress_description
  response["progressDescription"]
end

#providerString

The provider of the special

Returns:

  • (String)


92
93
94
# File 'lib/foursquared/response/special.rb', line 92

def provider
  response["provider"]
end

#redemptionString

Type of redemption

Returns:

  • (String)


98
99
100
# File 'lib/foursquared/response/special.rb', line 98

def redemption
  response["redemption"]
end

#stateString

The state of the special

Returns:

  • (String)

    unlocked, before start, in progress, taken, or locked



68
69
70
# File 'lib/foursquared/response/special.rb', line 68

def state
  response["state"]
end

#titleString

The header text describing the type of special.

Returns:

  • (String)


62
63
64
# File 'lib/foursquared/response/special.rb', line 62

def title
  response["title"]
end

#typeString

One of mayor, count, frequency, regular, friends, swarm, flash or other.

Returns:

  • (String)


26
27
28
# File 'lib/foursquared/response/special.rb', line 26

def type
  response["type"]
end

#unlocked?Boolean

If the user has unlocked the special

Returns:

  • (Boolean)


44
45
46
# File 'lib/foursquared/response/special.rb', line 44

def unlocked?
  response["unlocked"]
end