Class: Whatser::Poi

Inherits:
Resource show all
Defined in:
lib/whatser/resources/poi.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#api_request, api_request, client, convert_data_to_model, from_hash_to_model, #initialize, set

Constructor Details

This class inherits a constructor from Whatser::Resource

Instance Attribute Details

#branded_tagsObject

Returns the value of attribute branded_tags.



6
7
8
# File 'lib/whatser/resources/poi.rb', line 6

def branded_tags
  @branded_tags
end

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def city
  @city
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def country
  @country
end

#created_atObject

Returns the value of attribute created_at.



6
7
8
# File 'lib/whatser/resources/poi.rb', line 6

def created_at
  @created_at
end

#directionsObject

Returns the value of attribute directions.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def directions
  @directions
end

#districtObject

Returns the value of attribute district.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def district
  @district
end

#foursquare_idObject

Returns the value of attribute foursquare_id.



3
4
5
# File 'lib/whatser/resources/poi.rb', line 3

def foursquare_id
  @foursquare_id
end

#gowalla_idObject

Returns the value of attribute gowalla_id.



3
4
5
# File 'lib/whatser/resources/poi.rb', line 3

def gowalla_id
  @gowalla_id
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/whatser/resources/poi.rb', line 3

def id
  @id
end

#latObject

Returns the value of attribute lat.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def lat
  @lat
end

#lngObject

Returns the value of attribute lng.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def lng
  @lng
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def name
  @name
end

#opening_timesObject

Returns the value of attribute opening_times.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def opening_times
  @opening_times
end

#payment_methodsObject

Returns the value of attribute payment_methods.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def payment_methods
  @payment_methods
end

#phone_numberObject

Returns the value of attribute phone_number.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def phone_number
  @phone_number
end

#postal_codeObject

Returns the value of attribute postal_code.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def postal_code
  @postal_code
end

#pricingObject

Returns the value of attribute pricing.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def pricing
  @pricing
end

#regionObject

Returns the value of attribute region.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def region
  @region
end

#streetObject

Returns the value of attribute street.



5
6
7
# File 'lib/whatser/resources/poi.rb', line 5

def street
  @street
end

#tag_listObject

Returns the value of attribute tag_list.



6
7
8
# File 'lib/whatser/resources/poi.rb', line 6

def tag_list
  @tag_list
end

#user_idObject

Returns the value of attribute user_id.



3
4
5
# File 'lib/whatser/resources/poi.rb', line 3

def user_id
  @user_id
end

#websiteObject

Returns the value of attribute website.



4
5
6
# File 'lib/whatser/resources/poi.rb', line 4

def website
  @website
end

Class Method Details

.create(params = {}) ⇒ Object



21
22
23
# File 'lib/whatser/resources/poi.rb', line 21

def create(params={})
  api_request :post, "/api/poi", {:body => {'poi' => params} }
end

.delete(poi_id) ⇒ Object



25
26
27
# File 'lib/whatser/resources/poi.rb', line 25

def delete(poi_id)
  api_request :delete, "/api/poi/#{poi_id}"
end

.find(id, opts = {}) ⇒ Object



17
18
19
# File 'lib/whatser/resources/poi.rb', line 17

def find(id, opts={})
  api_request :get, "/api/poi/#{id}", {:query => opts}
end

.search(opts = {}) ⇒ Object



13
14
15
# File 'lib/whatser/resources/poi.rb', line 13

def search(opts={})
  api_request :get, "/api/poi", {:query => opts}
end

.suggested(opts = {}) ⇒ Object



9
10
11
# File 'lib/whatser/resources/poi.rb', line 9

def suggested(opts={})
  api_request :get, "/api/poi/suggested", {:query => opts}
end

Instance Method Details

#activity(opts) ⇒ Object



67
68
69
# File 'lib/whatser/resources/poi.rb', line 67

def activity(opts)
  Whatser::ActivityFeed.set(self.class.client).spot( self.id, opts )
end

#collectors(opts = {}) ⇒ Object



79
80
81
# File 'lib/whatser/resources/poi.rb', line 79

def collectors(opts={})
  Whatser::User.set(self.class.client).collectors(id, opts)
end

#comments(opts = {}) ⇒ Object



71
72
73
# File 'lib/whatser/resources/poi.rb', line 71

def comments(opts={})
  Whatser::Comment.set(self.class.client).poi(id, opts)
end

#deleteObject



51
52
53
# File 'lib/whatser/resources/poi.rb', line 51

def delete
  Whatser::Poi.delete(id)
end

#foursquare_connected?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/whatser/resources/poi.rb', line 83

def foursquare_connected?
  !foursquare_id.blank?
end

#gowalla_connected?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/whatser/resources/poi.rb', line 87

def gowalla_connected?
  !gowalla_id.blank?
end

#media(opts = {}) ⇒ Object



63
64
65
# File 'lib/whatser/resources/poi.rb', line 63

def media(opts={})
  Whatser::Media.list(id, opts)
end

#saveObject



43
44
45
46
47
48
49
# File 'lib/whatser/resources/poi.rb', line 43

def save
  if id.blank?
    self.class.create(to_params)
  else
    api_request :put, "/api/poi/#{id}", {:body => {'poi' => to_params} }
  end
end

#tag(tag_name) ⇒ Object



55
56
57
# File 'lib/whatser/resources/poi.rb', line 55

def tag(tag_name)
  Whatser::Tag.create(id, tag_name)
end

#tags(opts = {}) ⇒ Object



59
60
61
# File 'lib/whatser/resources/poi.rb', line 59

def tags(opts={})
  Whatser::Tag.list(id, opts)
end

#to_paramsObject



91
92
93
94
# File 'lib/whatser/resources/poi.rb', line 91

def to_params
  {:name=>name,:lat=>lat,:lng=>lat,:street=>street,:district=>district,
   :region=>region,:city=>city,:postal_code=>postal_code,:country=>country}
end

#visitors(opts = {}) ⇒ Object



75
76
77
# File 'lib/whatser/resources/poi.rb', line 75

def visitors(opts={})
  Whatser::User.set(self.class.client).visitors(id, opts)
end