Class: KeeperSecretsManager::Dto::KeeperFile

Inherits:
Object
  • Object
show all
Defined in:
lib/keeper_secrets_manager/dto.rb

Overview

File attachment representation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ KeeperFile

Returns a new instance of KeeperFile.



487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/keeper_secrets_manager/dto.rb', line 487

def initialize(attrs = {})
  @uid = attrs['fileUid'] || attrs['uid'] || attrs[:uid]
  @name = attrs['name'] || attrs[:name]
  @title = attrs['title'] || attrs[:title] || @name
  @mime_type = attrs['mimeType'] || attrs['mime_type'] || attrs[:mime_type]
  @size = attrs['size'] || attrs[:size]
  @data = attrs['data'] || attrs[:data]
  @url = attrs['url'] || attrs[:url]
  @thumbnail_url = attrs['thumbnailUrl'] || attrs['thumbnail_url'] || attrs[:thumbnail_url]
  @last_modified = attrs['lastModified'] || attrs['last_modified'] || attrs[:last_modified]
  @file_key = attrs['fileKey'] || attrs['file_key'] || attrs[:file_key]
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def data
  @data
end

#file_keyObject

Returns the value of attribute file_key.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def file_key
  @file_key
end

#last_modifiedObject

Returns the value of attribute last_modified.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def last_modified
  @last_modified
end

#mime_typeObject

Returns the value of attribute mime_type.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def mime_type
  @mime_type
end

#nameObject

Returns the value of attribute name.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def name
  @name
end

#sizeObject

Returns the value of attribute size.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def size
  @size
end

#thumbnail_urlObject

Returns the value of attribute thumbnail_url.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def thumbnail_url
  @thumbnail_url
end

#titleObject

Returns the value of attribute title.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def title
  @title
end

#uidObject

Returns the value of attribute uid.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def uid
  @uid
end

#urlObject

Returns the value of attribute url.



485
486
487
# File 'lib/keeper_secrets_manager/dto.rb', line 485

def url
  @url
end

Instance Method Details

#to_hObject



500
501
502
503
504
505
506
507
508
# File 'lib/keeper_secrets_manager/dto.rb', line 500

def to_h
  {
    'fileUid' => uid,
    'name' => name,
    'title' => title,
    'mimeType' => mime_type,
    'size' => size
  }.compact
end