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(string) bundle_registration_code - string encoded_paths - array(string).
Instance Method Summary collapse
-
#bundle_registration_code ⇒ Object
string.
- #bundle_registration_code=(value) ⇒ Object
-
#download_uri ⇒ Object
string - URL for downloading the ZIP.
- #download_uri=(value) ⇒ Object
-
#encoded_paths ⇒ Object
array(string).
- #encoded_paths=(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(string)
bundle_registration_code - string
encoded_paths - array(string)
63 64 65 66 67 68 69 70 71 |
# File 'lib/files.com/models/zip_download.rb', line 63 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params[:paths] and !params[:paths].is_a?(Array) raise InvalidParameterError.new("Bad parameter: bundle_registration_code must be an String") if params[:bundle_registration_code] and !params[:bundle_registration_code].is_a?(String) raise InvalidParameterError.new("Bad parameter: encoded_paths must be an Array") if params[:encoded_paths] and !params[:encoded_paths].is_a?(Array) raise MissingParameterError.new("Parameter missing: paths") unless params[:paths] response, = Api.send_request("/zip_downloads", :post, params, ) ZipDownload.new(response.data, ) end |
Instance Method Details
#bundle_registration_code ⇒ Object
string
31 32 33 |
# File 'lib/files.com/models/zip_download.rb', line 31 def bundle_registration_code @attributes[:bundle_registration_code] end |
#bundle_registration_code=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/zip_download.rb', line 35 def bundle_registration_code=(value) @attributes[:bundle_registration_code] = value end |
#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 |
#encoded_paths ⇒ Object
array(string)
40 41 42 |
# File 'lib/files.com/models/zip_download.rb', line 40 def encoded_paths @attributes[:encoded_paths] end |
#encoded_paths=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/zip_download.rb', line 44 def encoded_paths=(value) @attributes[:encoded_paths] = 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
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/files.com/models/zip_download.rb', line 48 def save if @attributes[:id] raise NotImplementedError.new("The ZipDownload object doesn't support updates.") else new_obj = ZipDownload.create(@attributes, @options) end @attributes = new_obj.attributes true end |