Class: BunnyCdn::Resources::Storage
- Defined in:
- lib/bunny_cdn/resources/storage.rb
Instance Attribute Summary collapse
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#zone_name ⇒ Object
readonly
Returns the value of attribute zone_name.
Attributes inherited from Base
Instance Method Summary collapse
- #delete(remote_path) ⇒ Object
- #get(remote_path) ⇒ Object
-
#initialize(client, zone_name:, region: nil) ⇒ Storage
constructor
A new instance of Storage.
- #list(path: "") ⇒ Object
- #upload(remote_path, file) ⇒ Object
Constructor Details
#initialize(client, zone_name:, region: nil) ⇒ Storage
Returns a new instance of Storage.
6 7 8 9 10 |
# File 'lib/bunny_cdn/resources/storage.rb', line 6 def initialize(client, zone_name:, region: nil) super(client) @zone_name = zone_name @region = region end |
Instance Attribute Details
#region ⇒ Object (readonly)
Returns the value of attribute region.
4 5 6 |
# File 'lib/bunny_cdn/resources/storage.rb', line 4 def region @region end |
#zone_name ⇒ Object (readonly)
Returns the value of attribute zone_name.
4 5 6 |
# File 'lib/bunny_cdn/resources/storage.rb', line 4 def zone_name @zone_name end |
Instance Method Details
#delete(remote_path) ⇒ Object
25 26 27 |
# File 'lib/bunny_cdn/resources/storage.rb', line 25 def delete(remote_path) super("#{zone_name}/#{remote_path}") end |
#get(remote_path) ⇒ Object
16 17 18 |
# File 'lib/bunny_cdn/resources/storage.rb', line 16 def get(remote_path) super("#{zone_name}/#{remote_path}") end |
#list(path: "") ⇒ Object
12 13 14 |
# File 'lib/bunny_cdn/resources/storage.rb', line 12 def list(path: "") get(normalize_path(path)) end |
#upload(remote_path, file) ⇒ Object
20 21 22 23 |
# File 'lib/bunny_cdn/resources/storage.rb', line 20 def upload(remote_path, file) contents = extract_file_data(file) put_request("#{zone_name}/#{remote_path}", contents) end |