Sha256: 2c156d841b141658bf4cb5d2333f8bfc4c7d2b2e6e508811f91a38b596d4d3b7

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

module Whatser
  class Detail < Whatser::Resource
    attr_accessor :id,:user_id,:poi_id
    attr_accessor :data,:created_at
    
    class << self
      def list(poi_id, opts={})
        api_request :get, "/api/poi/#{poi_id}/details", {:query => opts}
      end
              
      def find(poi_id, id, opts={})
        api_request :get, "/api/poi/#{poi_id}/details/#{id}", {:query => opts}
      end
      
      def create(poi_id, params={})
        api_request :post, "/api/poi/#{poi_id}/details", {:body => {'detail' => params} }
      end  
      
      def delete(poi_id, id)
        api_request :delete, "/api/poi/#{poi_id}/details/#{id}"
      end              
    end      
    
    def save
      if id.blank?
        self.class.create(poi_id, to_params)
      else
        api_request :put, "/api/poi/#{poi_id}/details/#{id}", {:body => {'detail' => to_params} }
      end
    end           
    
    def delete
      self.class.delete(poi_id, id)
    end       
    
    def to_params
      {:data => data}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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