Class: Files::ZipDownload
- Inherits:
-
Object
- Object
- Files::ZipDownload
- Defined in:
- lib/files.com/models/zip_download.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.create(params = {}, options = {}) ⇒ Object
Parameters: paths (required) - array.
Instance Method Summary collapse
-
#download_uri ⇒ Object
string - URL for downloading the ZIP.
- #download_uri=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ ZipDownload
constructor
A new instance of ZipDownload.
-
#paths ⇒ Object
array(string).
- #paths=(value) ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ ZipDownload
Returns a new instance of ZipDownload.
7 8 9 10 |
# File 'lib/files.com/models/zip_download.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/zip_download.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/zip_download.rb', line 5 def @options end |
Class Method Details
.create(params = {}, options = {}) ⇒ Object
Parameters:
paths (required) - array
41 42 43 44 45 46 47 |
# File 'lib/files.com/models/zip_download.rb', line 41 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params.dig(:paths) and !params.dig(:paths).is_a?(Array) raise MissingParameterError.new("Parameter missing: paths") unless params.dig(:paths) response, = Api.send_request("/zip_downloads", :post, params, ) ZipDownload.new(response.data, ) end |
Instance Method Details
#download_uri ⇒ Object
string - URL for downloading the ZIP
13 14 15 |
# File 'lib/files.com/models/zip_download.rb', line 13 def download_uri @attributes[:download_uri] end |
#download_uri=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/zip_download.rb', line 17 def download_uri=(value) @attributes[:download_uri] = value end |
#paths ⇒ Object
array(string)
22 23 24 |
# File 'lib/files.com/models/zip_download.rb', line 22 def paths @attributes[:paths] end |
#paths=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/zip_download.rb', line 26 def paths=(value) @attributes[:paths] = value end |
#save ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/files.com/models/zip_download.rb', line 30 def save if @attributes[:id] raise NotImplementedError.new("The ZipDownload object doesn't support updates.") else new_obj = ZipDownload.create(@attributes, @options) @attributes = new_obj.attributes end end |