Sha256: 1b2e745529fda15d286a8d1607332f53cf6aad4571eec3ad0392e104d0f88948
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
module Whatser class Poi < Whatser::Resource attr_accessor :id,:user_id,:gowalla_id,:foursquare_id attr_accessor :name,:lat,:lng,:street,:district,:region,:city,:postal_code,:country attr_accessor :tag_list,:created_at class << self def suggested(opts={}) api_request :get, "/api/poi/suggested", {:query => opts} end def search(opts={}) api_request :get, "/api/poi", {:query => opts} end def find(id, opts={}) api_request :get, "/api/poi/#{id}", {:query => opts} end def create(params={}) api_request :post, "/api/poi", {:body => {'poi' => params} } end def delete(poi_id) api_request :delete, "/api/poi/#{poi_id}" end end def save if id.blank? self.class.create(to_params) else api_request :put, "/api/poi/#{id}", {:body => {'poi' => to_params} } end end def delete Whatser::Poi.delete(id) end def tag(tag_name) Whatser::Tag.create(id, tag_name) end def tags(opts={}) Whatser::Tag.list(id, opts) end def media(opts={}) Whatser::Media.list(id, opts) end def reviews(opts={}) Whatser::Review.set(self.class.client).list(id, opts) end def details(opts={}) Whatser::Detail.set(self.class.client).list(id, opts) end def activity(opts) Whatser::ActivityFeed.set(self.class.client).spot( self.id, opts ) end def comments(opts={}) Whatser::Comment.set(self.class.client).poi(id, opts) end def foursquare_connected? !foursquare_id.blank? end def gowalla_connected? !gowalla_id.blank? end def to_params {:name=>name,:lat=>lat,:lng=>lat,:street=>street,:district=>district, :region=>region,:city=>city,:postal_code=>postal_code,:country=>country} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whatser-0.4.0 | lib/whatser/resources/poi.rb |