Class: Etna::Clients::Metis::File
- Inherits:
-
Object
- Object
- Etna::Clients::Metis::File
- Defined in:
- lib/etna/clients/metis/models.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #bucket_name ⇒ Object
- #download_path ⇒ Object
- #download_url ⇒ Object
- #file_name ⇒ Object
- #file_path ⇒ Object
-
#initialize(raw = {}) ⇒ File
constructor
A new instance of File.
- #project_name ⇒ Object
- #size ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(raw = {}) ⇒ File
Returns a new instance of File.
224 225 226 |
# File 'lib/etna/clients/metis/models.rb', line 224 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
222 223 224 |
# File 'lib/etna/clients/metis/models.rb', line 222 def raw @raw end |
Instance Method Details
#bucket_name ⇒ Object
236 237 238 |
# File 'lib/etna/clients/metis/models.rb', line 236 def bucket_name raw[:bucket_name] end |
#download_path ⇒ Object
240 241 242 243 244 |
# File 'lib/etna/clients/metis/models.rb', line 240 def download_path raw[:download_url].nil? ? "/#{project_name}/download/#{bucket_name}/#{file_path}" : raw[:download_url].sub(%r!^https://[^/]*?/!, '/') end |
#download_url ⇒ Object
246 247 248 |
# File 'lib/etna/clients/metis/models.rb', line 246 def download_url raw[:download_url] || '' end |
#file_name ⇒ Object
250 251 252 |
# File 'lib/etna/clients/metis/models.rb', line 250 def file_name raw[:file_name] end |
#file_path ⇒ Object
228 229 230 |
# File 'lib/etna/clients/metis/models.rb', line 228 def file_path raw[:file_path] end |
#project_name ⇒ Object
232 233 234 |
# File 'lib/etna/clients/metis/models.rb', line 232 def project_name raw[:project_name] end |
#size ⇒ Object
259 260 261 |
# File 'lib/etna/clients/metis/models.rb', line 259 def size raw[:size] end |
#updated_at ⇒ Object
254 255 256 257 |
# File 'lib/etna/clients/metis/models.rb', line 254 def updated_at time = raw[:updated_at] time.nil? ? nil : Time.parse(time) end |