1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2172 from burns/remove_deprecated_block

[rackspace] remove deprecated response block from request
This commit is contained in:
Kyle Rames 2013-09-24 13:40:57 -07:00
commit 66d4aefc95
11 changed files with 77 additions and 82 deletions

View file

@ -87,8 +87,8 @@ module Fog
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error

View file

@ -160,8 +160,8 @@ module Fog
true
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise Fog::Storage::Rackspace::NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error

View file

@ -205,8 +205,8 @@ module Fog
@connection.reset
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error

View file

@ -148,8 +148,8 @@ module Fog
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error

View file

@ -85,8 +85,8 @@ module Fog
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error

View file

@ -111,9 +111,8 @@ module Fog
private
def request(params, parse_json = true, &block)
begin
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error
@ -127,7 +126,6 @@ module Fog
rescue Excon::Errors::HTTPStatusError => error
raise ServiceError.slurp(error, self)
end
end
def array_to_query_string(arr)
return "" unless arr

View file

@ -120,8 +120,8 @@ module Fog
@connection = Fog::Connection.new(endpoint_uri.to_s, @persistent, @connection_options)
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error

View file

@ -129,8 +129,8 @@ module Fog
private
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::BadRequest => error
raise BadRequest.slurp(error, self)
rescue Excon::Errors::Conflict => error

View file

@ -13,19 +13,17 @@ module Fog
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
# @raise [Fog::Storage::Rackspace::ServiceError]
def get_object(container, object, &block)
params = {}
if block_given?
params[:response_block] = Proc.new
end
request(params.merge!({
params = {
:expects => 200,
:method => 'GET',
:path => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
}),
false,
&block)
}
if block_given?
params[:response_block] = block
end
request(params, false)
end
end

View file

@ -30,17 +30,17 @@ module Fog
self.send authentication_method, options
end
def request_without_retry(params, parse_json = true, &block)
response = @connection.request(request_params(params), &block)
def request_without_retry(params, parse_json = true)
response = @connection.request(request_params(params))
process_response(response) if parse_json
response
end
def request(params, parse_json = true, &block)
def request(params, parse_json = true)
first_attempt = true
begin
response = @connection.request(request_params(params), &block)
response = @connection.request(request_params(params))
rescue Excon::Errors::Unauthorized => error
raise error unless first_attempt
first_attempt = false
@ -70,8 +70,7 @@ module Fog
end
def headers(options={})
h = {
'Content-Type' => 'application/json',
{ 'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => auth_token
}.merge(options[:headers] || {})

View file

@ -145,8 +145,8 @@ module Fog
@connection.reset
end
def request(params, parse_json = true, &block)
super(params, parse_json, &block)
def request(params, parse_json = true)
super
rescue Excon::Errors::NotFound => error
raise NotFound.slurp(error, self)
rescue Excon::Errors::BadRequest => error