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



184
185
186
187
188
189
190
191
192
# File 'lib/keeper_secrets_manager/dto.rb', line 184

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]
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def data
  @data
end

#mime_typeObject

Returns the value of attribute mime_type.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def mime_type
  @mime_type
end

#nameObject

Returns the value of attribute name.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def name
  @name
end

#sizeObject

Returns the value of attribute size.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def size
  @size
end

#titleObject

Returns the value of attribute title.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def title
  @title
end

#uidObject

Returns the value of attribute uid.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def uid
  @uid
end

#urlObject

Returns the value of attribute url.



182
183
184
# File 'lib/keeper_secrets_manager/dto.rb', line 182

def url
  @url
end

Instance Method Details

#to_hObject



194
195
196
197
198
199
200
201
202
# File 'lib/keeper_secrets_manager/dto.rb', line 194

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