Sha256: 4cef40c25b774ffae805451332f04aba1b9f8cdf88ed26a9bd881eac3a0dc520

Contents?: true

Size: 723 Bytes

Versions: 5

Compression:

Stored size: 723 Bytes

Contents

module Whatser
  class Tag < Whatser::Resource
    attr_accessor :id,:poi_id
    attr_accessor :name
    
    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

5 entries across 5 versions & 1 rubygems

Version Path
whatser-0.4.0 lib/whatser/resources/tag.rb
whatser-0.3.2 lib/whatser/resources/tag.rb
whatser-0.3.1 lib/whatser/resources/tag.rb
whatser-0.3.0 lib/whatser/resources/tag.rb
whatser-0.2.0 lib/whatser/resources/tag.rb