Class: Foursquared::Response::Category
- Inherits:
-
Object
- Object
- Foursquared::Response::Category
- Defined in:
- lib/foursquared/response/category.rb
Overview
Category object
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#categories ⇒ Array
The sub-categories for the category.
-
#icon ⇒ Hash
Return the details for icons of the category.
-
#id ⇒ String
Return the id of the category.
-
#initialize(response) ⇒ Category
constructor
A new instance of Category.
-
#name ⇒ String
Return the name of the category.
-
#plural_name ⇒ String
Return the plural name of the category.
-
#short_name ⇒ String
Return the short name of the category.
Constructor Details
#initialize(response) ⇒ Category
Returns a new instance of Category.
6 7 8 |
# File 'lib/foursquared/response/category.rb', line 6 def initialize response @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/foursquared/response/category.rb', line 5 def response @response end |
Instance Method Details
#categories ⇒ Array
The sub-categories for the category
48 49 50 |
# File 'lib/foursquared/response/category.rb', line 48 def categories response["categories"].map!{|category| Foursquared::Response::Category.new(category)} end |
#icon ⇒ Hash
Return the details for icons of the category
36 37 38 39 40 41 42 43 44 |
# File 'lib/foursquared/response/category.rb', line 36 def icon @icon = response["icon"] @icon["urls"] = { "32x32" => "#{@icon["prefix"].chomp("_")}#{@icon["suffix"]}", "64x64" => "#{@icon["prefix"]}_64#{@icon["suffix"]}", "256x256" => "#{@icon["prefix"]}_256#{@icon["suffix"]}", } @icon end |
#id ⇒ String
Return the id of the category
12 13 14 |
# File 'lib/foursquared/response/category.rb', line 12 def id response["id"] end |
#name ⇒ String
Return the name of the category
18 19 20 |
# File 'lib/foursquared/response/category.rb', line 18 def name response["name"] end |
#plural_name ⇒ String
Return the plural name of the category
24 25 26 |
# File 'lib/foursquared/response/category.rb', line 24 def plural_name response["pluralName"] end |
#short_name ⇒ String
Return the short name of the category
30 31 32 |
# File 'lib/foursquared/response/category.rb', line 30 def short_name response["shortName"] end |