lib/acfs/request.rb in acfs-0.7.0 vs lib/acfs/request.rb in acfs-0.8.0
- old
+ new
@@ -5,19 +5,20 @@
# Encapsulate all data required to make up a request to the
# underlaying http library.
#
class Request
attr_accessor :body, :format
- attr_reader :url, :headers, :params, :data
+ attr_reader :url, :headers, :params, :data, :method
include Request::Callbacks
def initialize(url, options = {}, &block)
@url = URI.parse(url).tap do |url|
@data = options.delete(:data) || nil
@format = options.delete(:format) || :json
@headers = options.delete(:headers) || {}
@params = options.delete(:params) || {}
+ @method = options.delete(:method) || :get
url.query = nil # params.any? ? params.to_param : nil
end.to_s
on_complete &block if block_given?
end