Class: Aliyun::OSS::Service
- Defined in:
- lib/aliyun/oss/service.rb,
lib/aliyun/oss/response.rb
Overview
The service lets you find out general information about your account, like what buckets you have.
Service.buckets
# => []
Defined Under Namespace
Classes: Response
Constant Summary collapse
- @@response =
:nodoc:
nil
Class Method Summary collapse
-
.buckets ⇒ Object
List all your buckets.
-
.response ⇒ Object
Sometimes methods that make requests to the OSS servers return some object, like a Bucket or an OSSObject.
-
.response=(response) ⇒ Object
:nodoc:.
Methods inherited from Base
current_bucket, #initialize, request, set_current_bucket_to
Constructor Details
This class inherits a constructor from Aliyun::OSS::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aliyun::OSS::Base
Class Method Details
.buckets ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/aliyun/oss/service.rb', line 21 def buckets response = get('/') if response.empty? [] else response.buckets.map {|attributes| Bucket.new(attributes)} end end |
.response ⇒ Object
Sometimes methods that make requests to the OSS servers return some object, like a Bucket or an OSSObject. Other times they return just true
. Other times they raise an exception that you may want to rescue. Despite all these possible outcomes, every method that makes a request stores its response object for you in Service.response. You can always get to the last request’s response via Service.response.
objects = Bucket.objects('jukebox')
Service.response.success?
# => true
This is also useful when an error exception is raised in the console which you weren’t expecting. You can root around in the response to get more details of what might have gone wrong.
42 43 44 |
# File 'lib/aliyun/oss/service.rb', line 42 def response @@response end |
.response=(response) ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/aliyun/oss/service.rb', line 46 def response=(response) #:nodoc: @@response = response end |