Sha256: 9e89dabd8668a00f8c46fec73506fc1c0e96d71d527c78b69337197433bf326b
Contents?: true
Size: 923 Bytes
Versions: 22
Compression:
Stored size: 923 Bytes
Contents
require 'acfs/request/callbacks' module Acfs # 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, :method, :operation include Request::Callbacks def initialize(url, options = {}, &block) @url = URI.parse(url.to_s).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 end.to_s @operation = options.delete(:operation) || nil on_complete(&block) if block_given? end def data? !data.nil? end class << self def new(*attrs) return attrs[0] if attrs[0].is_a? self super end end end end
Version data entries
22 entries across 22 versions & 1 rubygems