Class: Gcloud::Storage::File::List
- Inherits:
-
Array
- Object
- Array
- Gcloud::Storage::File::List
- Defined in:
- lib/gcloud/storage/file/list.rb
Overview
File::List is a special case Array with additional values.
Instance Attribute Summary collapse
-
#prefixes ⇒ Object
The list of prefixes of objects matching-but-not-listed up to and including the requested delimiter.
-
#token ⇒ Object
If not empty, indicates that there are more buckets that match the request and this value should be passed to the next Gcloud::Storage::Bucket#files to continue.
Class Method Summary collapse
-
.from_resp(resp, conn) ⇒ Object
New File::List from a response object.
Instance Method Summary collapse
-
#initialize(arr = [], token = nil, prefixes = []) ⇒ List
constructor
Create a new File::List with an array of values.
Constructor Details
#initialize(arr = [], token = nil, prefixes = []) ⇒ List
Create a new File::List with an array of values.
33 34 35 36 37 |
# File 'lib/gcloud/storage/file/list.rb', line 33 def initialize arr = [], token = nil, prefixes = [] super arr @token = token @prefixes = prefixes end |
Instance Attribute Details
#prefixes ⇒ Object
The list of prefixes of objects matching-but-not-listed up to and including the requested delimiter.
29 30 31 |
# File 'lib/gcloud/storage/file/list.rb', line 29 def prefixes @prefixes end |
#token ⇒ Object
If not empty, indicates that there are more buckets that match the request and this value should be passed to the next Gcloud::Storage::Bucket#files to continue.
25 26 27 |
# File 'lib/gcloud/storage/file/list.rb', line 25 def token @token end |
Class Method Details
.from_resp(resp, conn) ⇒ Object
New File::List from a response object.
41 42 43 44 45 46 47 48 |
# File 'lib/gcloud/storage/file/list.rb', line 41 def self.from_resp resp, conn #:nodoc: buckets = Array(resp.data["items"]).map do |gapi_object| File.from_gapi gapi_object, conn end token = resp.data["nextPageToken"] prefixes = Array resp.data["prefixes"] new buckets, token, prefixes end |