lib/rapidash/base.rb in rapidash-0.0.2 vs lib/rapidash/base.rb in rapidash-0.0.3

- old
+ new

@@ -17,9 +17,26 @@ @options.merge!(options || {}) @url = "#{base_url}#{self.class.to_s.split("::")[-1].downcase}" @url += "/#{@id}" if @id end + def create!(params) + self.options[:method] = :post + self.options[:body] = params.to_json + call! + end + + def update!(params) + self.options[:method] = :put + self.options[:body] = params.to_json + call! + end + + def delete! + self.options[:method] = :delete + call! + end + def call! self.options ||= {} self.options.delete(:previous_url) self.options[:header] ||= {}