lib/ovto/fetch.rb in ovto-0.4.1 vs lib/ovto/fetch.rb in ovto-0.5.0
- old
+ new
@@ -5,10 +5,10 @@
module Ovto
# Wrapper for the fetch API
# The server must respond a json text.
#
# Example:
- # Ovto.fetch('/api/new_task', 'POST', {title: "do something"}){|json_data|
+ # Ovto.fetch('/api/new_task', 'POST', {title: "do something"}).then{|json_data|
# p json_data
# }.fail{|e| # Network error, 404 Not Found, JSON parse error, etc.
# p e
# }
def self.fetch(url, method='GET', data=nil)