Class: B2::Bucket
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#authorization_token ⇒ Object
Returns the value of attribute authorization_token.
-
#bucket_id ⇒ Object
Returns the value of attribute bucket_id.
-
#bucket_name ⇒ Object
Returns the value of attribute bucket_name.
-
#bucket_type ⇒ Object
Returns the value of attribute bucket_type.
-
#buckets ⇒ Object
Returns the value of attribute buckets.
-
#files ⇒ Object
Returns the value of attribute files.
-
#upload_url ⇒ Object
Returns the value of attribute upload_url.
Attributes inherited from Base
Instance Method Summary collapse
- #create(bucket_name, bucket_type) ⇒ Object
- #delete(bucket_id) ⇒ Object
- #get_upload_url(bucket_id) ⇒ Object
- #list ⇒ Object
- #list_file_names(bucket_id, startFileName: nil, maxFileCount: nil) ⇒ Object
- #list_file_versions(bucket_id, startFileName: nil, startFileId: nil, maxFileCount: nil) ⇒ Object
- #update_bucket(bucket_id, bucket_type) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from B2::Base
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def account_id @account_id end |
#authorization_token ⇒ Object
Returns the value of attribute authorization_token.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def @authorization_token end |
#bucket_id ⇒ Object
Returns the value of attribute bucket_id.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def bucket_id @bucket_id end |
#bucket_name ⇒ Object
Returns the value of attribute bucket_name.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def bucket_name @bucket_name end |
#bucket_type ⇒ Object
Returns the value of attribute bucket_type.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def bucket_type @bucket_type end |
#buckets ⇒ Object
Returns the value of attribute buckets.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def buckets @buckets end |
#files ⇒ Object
Returns the value of attribute files.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def files @files end |
#upload_url ⇒ Object
Returns the value of attribute upload_url.
3 4 5 |
# File 'lib/b2/bucket.rb', line 3 def upload_url @upload_url end |
Instance Method Details
#create(bucket_name, bucket_type) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/b2/bucket.rb', line 5 def create(bucket_name, bucket_type) body = { accountId: B2.account_id, bucketName: bucket_name, bucketType: bucket_type } response = post('/b2_create_bucket', body: body.to_json) assign_return_value(response) end |
#delete(bucket_id) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/b2/bucket.rb', line 15 def delete(bucket_id) body = { accountId: B2.account_id, bucketId: bucket_id } response = post('/b2_delete_bucket', body: body.to_json) assign_return_value(response) end |
#get_upload_url(bucket_id) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/b2/bucket.rb', line 43 def get_upload_url(bucket_id) body = { bucketId: bucket_id } response = post('/b2_get_upload_url', body: body.to_json) assign_return_value(response) end |
#list ⇒ Object
25 26 27 28 29 30 |
# File 'lib/b2/bucket.rb', line 25 def list body = {accountId: B2.account_id} response = post('/b2_list_buckets', body: body.to_json) assign_return_value(response) end |
#list_file_names(bucket_id, startFileName: nil, maxFileCount: nil) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/b2/bucket.rb', line 52 def list_file_names(bucket_id, startFileName: nil, maxFileCount: nil) body = { bucketId: bucket_id } body.merge!(startFileName: startFileName) if startFileName body.merge!(maxFileCount: maxFileCount) if maxFileCount response = post('/b2_list_file_names', body: body.to_json) assign_return_value(response) end |
#list_file_versions(bucket_id, startFileName: nil, startFileId: nil, maxFileCount: nil) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/b2/bucket.rb', line 63 def list_file_versions(bucket_id, startFileName: nil, startFileId: nil, maxFileCount: nil) body = { bucketId: bucket_id } body.merge!(startFileName: startFileName) if startFileName body.merge!(maxFileCount: maxFileCount) if maxFileCount body.merge!(startFileId: startFileId) if startFileId response = post('/b2_list_file_versions', body: body.to_json) assign_return_value(response) end |
#update_bucket(bucket_id, bucket_type) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/b2/bucket.rb', line 32 def update_bucket(bucket_id, bucket_type) body = { accountId: B2.account_id, bucketId: bucket_id, bucketType: bucket_type } response = post('/b2_update_bucket', body: body.to_json) assign_return_value(response) end |