Class: Gowalla::Spot

Inherits:
Base
  • Object
show all
Defined in:
lib/gowalla/spot.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = {}) ⇒ Spot

Returns a new instance of Spot.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gowalla/spot.rb', line 5

def initialize(data={})
  @name = data['name']
  @address = Address.new(data['address']) if !data['address'].blank?
  @url = data['url']
  @image_url = data['image_url']
  @activity_url = data['activity_url']
  @radius_meters = data['radius_meters']
  @remove_bookmark_url = data['remove_bookmark_url']
  @checkins_url = data['checkins_url']
  @checkins_count = data['checkins_count']
  @items_count = data['items_count']
  @facebook_url = data['facebook_url']
  @websites = data['websites']
  @founders = data['founders'].map{|user| User.new(user)} unless data['founders'].blank?
  @created_at = data['created_at']
  @description = data['description']
  @bookmarks_url = data['bookmarks_url']
  @max_items_count = data['max_items_count']
  @trending_level = data['trending_level']
  @lat = data['lat']
  @lng = data['lng']
  @users_count = data['users_count']
  @twitter_username = data['twitter_username']
  @creator = User.new(data['creator']) unless data['creator'].blank?
  @list_image_url_320 = data['list_image_url_320']
  @items_url = data['items_url']
  @spot_categories = data['spot_categories'].map{|c| Category.new(c)} unless data['spot_categories'].blank?
  @strict_radius = data['strict_radius']
  @map_bounds = MapBound.new(data['map_bounds']) unless data['map_bounds'].blank?
  @phone_number = data['phone_number']
  @top_10 = data['top_10'].map{|top_10| Top10.new(top_10)} unless data['top_10'].blank?
end

Instance Attribute Details

#activity_urlObject

Returns the value of attribute activity_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def activity_url
  @activity_url
end

#addressObject

Returns the value of attribute address.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def address
  @address
end

#bookmarks_urlObject

Returns the value of attribute bookmarks_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def bookmarks_url
  @bookmarks_url
end

#checkins_countObject

Returns the value of attribute checkins_count.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def checkins_count
  @checkins_count
end

#checkins_urlObject

Returns the value of attribute checkins_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def checkins_url
  @checkins_url
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def created_at
  @created_at
end

#creatorObject

Returns the value of attribute creator.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def creator
  @creator
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def description
  @description
end

#facebook_urlObject

Returns the value of attribute facebook_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def facebook_url
  @facebook_url
end

#foundersObject

Returns the value of attribute founders.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def founders
  @founders
end

#image_urlObject

Returns the value of attribute image_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def image_url
  @image_url
end

#items_countObject

Returns the value of attribute items_count.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def items_count
  @items_count
end

#items_urlObject

Returns the value of attribute items_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def items_url
  @items_url
end

#latObject

Returns the value of attribute lat.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def lat
  @lat
end

#list_image_url_320Object

Returns the value of attribute list_image_url_320.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def list_image_url_320
  @list_image_url_320
end

#lngObject

Returns the value of attribute lng.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def lng
  @lng
end

#map_boundsObject

Returns the value of attribute map_bounds.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def map_bounds
  @map_bounds
end

#max_items_countObject

Returns the value of attribute max_items_count.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def max_items_count
  @max_items_count
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def name
  @name
end

#phone_numberObject

Returns the value of attribute phone_number.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def phone_number
  @phone_number
end

#radius_metersObject

Returns the value of attribute radius_meters.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def radius_meters
  @radius_meters
end

#remove_bookmark_urlObject

Returns the value of attribute remove_bookmark_url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def remove_bookmark_url
  @remove_bookmark_url
end

#spot_categoriesObject

Returns the value of attribute spot_categories.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def spot_categories
  @spot_categories
end

#strict_radiusObject

Returns the value of attribute strict_radius.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def strict_radius
  @strict_radius
end

#top_10Object

Returns the value of attribute top_10.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def top_10
  @top_10
end

Returns the value of attribute trending_level.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def trending_level
  @trending_level
end

#twitter_usernameObject

Returns the value of attribute twitter_username.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def twitter_username
  @twitter_username
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def url
  @url
end

#users_countObject

Returns the value of attribute users_count.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def users_count
  @users_count
end

#websitesObject

Returns the value of attribute websites.



3
4
5
# File 'lib/gowalla/spot.rb', line 3

def websites
  @websites
end

Class Method Details

.find(id) ⇒ Object



37
38
39
# File 'lib/gowalla/spot.rb', line 37

def self.find(id)
  Spot.new(self.fetch(id))
end

Instance Method Details

#eventsObject



40
41
42
43
# File 'lib/gowalla/spot.rb', line 40

def events
  event_id = self.activity_url.split("/")[2] # TODO probably better way
  Event.new(Event.fetch(event_id))
end