Sha256: ff8593fc857082676f65bfb4d785ef7ed746d4d3ad83f1277553efc27a7764b1
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 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.list(id, opts) end def details(opts={}) Whatser::Detail.list(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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whatser-0.3.0 | lib/whatser/resources/poi.rb |
whatser-0.2.0 | lib/whatser/resources/poi.rb |