Class: B2bCenterApi::WebService::Types::AttachmentName
- Defined in:
- lib/b2b_center_api/web_service/types/attachment_name.rb
Overview
Файл для отправки
Constant Summary
Constants inherited from BaseType
Instance Attribute Summary collapse
-
#filename ⇒ String
readonly
Имя файла.
-
#md5 ⇒ String
readonly
MD5 от содержимого файла.
Attributes inherited from BaseType
Class Method Summary collapse
-
.from_array(files_array) ⇒ Array
Подготовка массива AttachmentName для отправки.
Instance Method Summary collapse
-
#initialize(file_path) ⇒ AttachmentName
constructor
A new instance of AttachmentName.
Methods inherited from BaseType
Methods included from B2bCenterApi::WebService::TypeCast
Constructor Details
#initialize(file_path) ⇒ AttachmentName
Returns a new instance of AttachmentName.
15 16 17 18 19 |
# File 'lib/b2b_center_api/web_service/types/attachment_name.rb', line 15 def initialize(file_path) file = File.new(file_path) @filename = File.basename(file_path) @md5 = Digest::MD5.hexdigest(file.read) end |
Instance Attribute Details
#filename ⇒ String (readonly)
Returns Имя файла.
10 11 12 |
# File 'lib/b2b_center_api/web_service/types/attachment_name.rb', line 10 def filename @filename end |
#md5 ⇒ String (readonly)
Returns MD5 от содержимого файла.
13 14 15 |
# File 'lib/b2b_center_api/web_service/types/attachment_name.rb', line 13 def md5 @md5 end |
Class Method Details
.from_array(files_array) ⇒ Array
Подготовка массива AttachmentName для отправки
24 25 26 27 28 |
# File 'lib/b2b_center_api/web_service/types/attachment_name.rb', line 24 def self.from_array(files_array) files_array.map do |file| { file: new(file).to_h } end end |