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.
209 210 211 |
# File 'lib/etna/clients/metis/models.rb', line 209 def initialize(raw = {}) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
207 208 209 |
# File 'lib/etna/clients/metis/models.rb', line 207 def raw @raw end |
Instance Method Details
#bucket_name ⇒ Object
221 222 223 |
# File 'lib/etna/clients/metis/models.rb', line 221 def bucket_name raw[:bucket_name] end |
#download_path ⇒ Object
225 226 227 228 229 |
# File 'lib/etna/clients/metis/models.rb', line 225 def download_path raw[:download_url].nil? ? "/#{project_name}/download/#{bucket_name}/#{file_path}" : raw[:download_url].sub(%r!^https://[^/]*?/!, '/') end |
#download_url ⇒ Object
231 232 233 |
# File 'lib/etna/clients/metis/models.rb', line 231 def download_url raw[:download_url] || '' end |
#file_name ⇒ Object
235 236 237 |
# File 'lib/etna/clients/metis/models.rb', line 235 def file_name raw[:file_name] end |
#file_path ⇒ Object
213 214 215 |
# File 'lib/etna/clients/metis/models.rb', line 213 def file_path raw[:file_path] end |
#project_name ⇒ Object
217 218 219 |
# File 'lib/etna/clients/metis/models.rb', line 217 def project_name raw[:project_name] end |
#size ⇒ Object
244 245 246 |
# File 'lib/etna/clients/metis/models.rb', line 244 def size raw[:size] end |
#updated_at ⇒ Object
239 240 241 242 |
# File 'lib/etna/clients/metis/models.rb', line 239 def updated_at time = raw[:updated_at] time.nil? ? nil : Time.parse(time) end |