Sha256: c69652c18cd2bc1ff77bf3f4af5e2b174de1dc45b46f2f82fc6b743b73b5425e

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

module Whatser
  class Tag < Whatser::Resource
    attr_accessor :id,:poi_id
    attr_accessor :name
    attr_accessor :web_list_pic,:web_detail_pic,:touch_list_pic,:touch_detail_pic,:wap_list_pic,:wap_detail_pic
    
    class << self
      def list(poi_id, opts={})
        api_request :get, "/api/poi/#{poi_id}/tags", {:query => opts}
      end
      
      def create(poi_id, tag_name)
        api_request :post, "/api/poi/#{poi_id}/tags", {:body => {'tagging' => {'name' => tag_name}} }
      end
      
      def delete(poi_id, tag_name)
        api_request :delete, "/api/poi/#{poi_id}/tags/#{tag_name}"
      end        
    end
    
    def save
      self.class.create(poi_id, name)
    end
    
    def delete
      self.class.delete(poi_id, name)
    end
    
    def to_params
      {:name => name}
    end      
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whatser-0.6.1 lib/whatser/resources/tag.rb
whatser-0.6.0 lib/whatser/resources/tag.rb
whatser-0.5.0 lib/whatser/resources/tag.rb