Class: CloudAlign::File
- Inherits:
-
BaseEntity
- Object
- BaseEntity
- CloudAlign::File
- Defined in:
- lib/cloudalign/file.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#ready ⇒ Object
Returns the value of attribute ready.
-
#size ⇒ Object
Returns the value of attribute size.
-
#storage_path ⇒ Object
Returns the value of attribute storage_path.
Attributes inherited from BaseEntity
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseEntity
Constructor Details
This class inherits a constructor from CloudAlign::BaseEntity
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/cloudalign/file.rb', line 3 def name @name end |
#ready ⇒ Object
Returns the value of attribute ready.
3 4 5 |
# File 'lib/cloudalign/file.rb', line 3 def ready @ready end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'lib/cloudalign/file.rb', line 3 def size @size end |
#storage_path ⇒ Object
Returns the value of attribute storage_path.
3 4 5 |
# File 'lib/cloudalign/file.rb', line 3 def storage_path @storage_path end |
Class Method Details
Instance Method Details
#download(output_path = nil) ⇒ Object
5 6 7 8 9 |
# File 'lib/cloudalign/file.rb', line 5 def download(output_path = nil) output_path = self.file_name if output_path.nil? download_info = Client.get_json("/artifacts/#{@artifact_id}/files/#{@id}/download") Client.get_file(download_info["download_url"], output_path) end |
#file_name ⇒ Object
11 12 13 |
# File 'lib/cloudalign/file.rb', line 11 def file_name ::File.basename(@storage_path) end |
#status ⇒ Object
15 16 17 18 |
# File 'lib/cloudalign/file.rb', line 15 def status statuses = %w(READY BUILDING UPLOADING) (@status >= 0 && @status < statuses.length) ? statuses[@status] : @status end |