Class: Foursquared::Response::Category

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

Overview

Category object

Instance Attribute Summary collapse

Instance Method Summary collapse

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

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

#categoriesArray

The sub-categories for the category

Returns:

  • (Array)

    array of sub-categories



48
49
50
# File 'lib/foursquared/response/category.rb', line 48

def categories
  response["categories"].map!{|category| Foursquared::Response::Category.new(category)}
end

#iconHash

Return the details for icons of the category

Returns:

  • (Hash)

    with urls added for each icon size



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

#idString

Return the id of the category

Returns:

  • (String)


12
13
14
# File 'lib/foursquared/response/category.rb', line 12

def id
  response["id"]
end

#nameString

Return the name of the category

Returns:

  • (String)


18
19
20
# File 'lib/foursquared/response/category.rb', line 18

def name
  response["name"]
end

#plural_nameString

Return the plural name of the category

Returns:

  • (String)


24
25
26
# File 'lib/foursquared/response/category.rb', line 24

def plural_name
  response["pluralName"]
end

#short_nameString

Return the short name of the category

Returns:

  • (String)


30
31
32
# File 'lib/foursquared/response/category.rb', line 30

def short_name
  response["shortName"]
end