Class: Aliyun::OSS::Base::Response
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from String
#previous, #previous!, #remove_extended, #remove_extended!, #tap, #to_header, #underscore, #valid_utf8?
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
8
9
10
11
12
|
# File 'lib/aliyun/oss/response.rb', line 8
def initialize(response)
@response = response
@body = response.body.to_s
super(body)
end
|
Instance Attribute Details
Returns the value of attribute body.
7
8
9
|
# File 'lib/aliyun/oss/response.rb', line 7
def body
@body
end
|
Returns the value of attribute parsed.
7
8
9
|
# File 'lib/aliyun/oss/response.rb', line 7
def parsed
@parsed
end
|
Returns the value of attribute response.
7
8
9
|
# File 'lib/aliyun/oss/response.rb', line 7
def response
@response
end
|
Instance Method Details
#[](header) ⇒ Object
23
24
25
|
# File 'lib/aliyun/oss/response.rb', line 23
def []()
[]
end
|
31
32
33
|
# File 'lib/aliyun/oss/response.rb', line 31
def code
response.code.to_i
end
|
#each(&block) ⇒ Object
27
28
29
|
# File 'lib/aliyun/oss/response.rb', line 27
def each(&block)
.each(&block)
end
|
49
50
51
|
# File 'lib/aliyun/oss/response.rb', line 49
def error
Error.new(parsed, self)
end
|
#error? ⇒ Boolean
45
46
47
|
# File 'lib/aliyun/oss/response.rb', line 45
def error?
!success? && response['content-type'] == 'application/xml' && parsed.root == 'error'
end
|
14
15
16
17
18
19
20
|
# File 'lib/aliyun/oss/response.rb', line 14
def
= {}
response.each do |, value|
[] = value
end
end
|
60
61
62
|
# File 'lib/aliyun/oss/response.rb', line 60
def inspect
"#<%s:0x%s %s %s>" % [self.class, object_id, response.code, response.message]
end
|