Class: Smartsheet::API::PathFileSpec
- Inherits:
-
Object
- Object
- Smartsheet::API::PathFileSpec
- Defined in:
- lib/smartsheet/api/file_spec.rb
Overview
Specification for a file attachment by path, target filename, and MIME content type
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#file_length ⇒ Object
readonly
Returns the value of attribute file_length.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#upload_io ⇒ Object
readonly
Returns the value of attribute upload_io.
Instance Method Summary collapse
-
#initialize(path, filename, content_type) ⇒ PathFileSpec
constructor
A new instance of PathFileSpec.
Constructor Details
#initialize(path, filename, content_type) ⇒ PathFileSpec
Returns a new instance of PathFileSpec.
10 11 12 13 14 15 |
# File 'lib/smartsheet/api/file_spec.rb', line 10 def initialize(path, filename, content_type) @file_length = File.size(path) @filename = (filename.nil? || filename.empty?) ? File.basename(path) : filename @upload_io = Faraday::UploadIO.new(path, content_type, CGI::escape(@filename)) @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
8 9 10 |
# File 'lib/smartsheet/api/file_spec.rb', line 8 def content_type @content_type end |
#file_length ⇒ Object (readonly)
Returns the value of attribute file_length.
8 9 10 |
# File 'lib/smartsheet/api/file_spec.rb', line 8 def file_length @file_length end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/smartsheet/api/file_spec.rb', line 8 def filename @filename end |
#upload_io ⇒ Object (readonly)
Returns the value of attribute upload_io.
8 9 10 |
# File 'lib/smartsheet/api/file_spec.rb', line 8 def upload_io @upload_io end |