Sha256: aa34ab9bd8800ffb8592a8509f2e24360e5642b2a4e49a8299ec2de51a23e29e

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

module OurKudos
  module ResourceEditor
      
      def self.resource= name
        @@resource = name
      end
      
      def self.resource
        @@resource
      end
      
      def create fields = {}
        post(:path => "#{self.resource}s.json",  :params =>  {resource.to_sym => fields})
      end
      
      def update(id, fields = {})
        put(:path => "#{self.resource}s/#{id.to_s}.json", :params => {resource.to_sym => fields })
      end
      
      def read id
        get(:path => "#{self.resource}s/#{id.to_s}.json", :params => {})
      end
      
      def destroy id
        delete(:path => "#{self.resource}s/#{id.to_s}.json", :params => {})
      end
    
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ourkudos-0.0.29 lib/ourkudos/resource_editor.rb