Class: Webspicy::Specification::FileUpload
- Inherits:
-
Object
- Object
- Webspicy::Specification::FileUpload
- Defined in:
- lib/webspicy/specification/file_upload.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#param_name ⇒ Object
readonly
Returns the value of attribute param_name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw) ⇒ FileUpload
constructor
A new instance of FileUpload.
- #locate(specification) ⇒ Object
- #to_info ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(raw) ⇒ FileUpload
Returns a new instance of FileUpload.
5 6 7 8 9 |
# File 'lib/webspicy/specification/file_upload.rb', line 5 def initialize(raw) @path = raw[:path] @content_type = raw[:content_type] @param_name = raw[:param_name] || "file" end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
11 12 13 |
# File 'lib/webspicy/specification/file_upload.rb', line 11 def content_type @content_type end |
#param_name ⇒ Object (readonly)
Returns the value of attribute param_name.
11 12 13 |
# File 'lib/webspicy/specification/file_upload.rb', line 11 def param_name @param_name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/webspicy/specification/file_upload.rb', line 11 def path @path end |
Class Method Details
.info(raw) ⇒ Object
13 14 15 |
# File 'lib/webspicy/specification/file_upload.rb', line 13 def self.info(raw) new(raw) end |
Instance Method Details
#locate(specification) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/webspicy/specification/file_upload.rb', line 17 def locate(specification) FileUpload.new({ path: specification.locate(path), content_type: content_type }) end |
#to_info ⇒ Object
24 25 26 27 28 |
# File 'lib/webspicy/specification/file_upload.rb', line 24 def to_info { path: path.to_s, content_type: content_type, param_name: param_name } end |
#to_s ⇒ Object Also known as: inspect
30 31 32 |
# File 'lib/webspicy/specification/file_upload.rb', line 30 def to_s "FileUpload(#{to_info})" end |