Class: Paperclip::Upyun::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip/upyun/response.rb

Class Method Summary collapse

Class Method Details

.error(res) ⇒ Object



12
13
14
# File 'lib/paperclip/upyun/response.rb', line 12

def self.error(res)
  raise Paperclip::Upyun::Exceptions::ResponseError, "#{res.to_s}"
end

.parse(res) ⇒ Object

Raises:

  • (TypeError)


5
6
7
8
9
10
# File 'lib/paperclip/upyun/response.rb', line 5

def self.parse(res)
  return true if res.is_a?(TrueClass)
  raise TypeError, "Upyun Response type: #{res.class}" unless res.is_a?(Hash)
  self.error(res) if res.has_key?(:error) || res.has_key?("error")
  true
end