Class: Webspicy::FileUpload
- Inherits:
-
Object
- Object
- Webspicy::FileUpload
- Defined in:
- lib/webspicy/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(resource) ⇒ Object
- #to_info ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(raw) ⇒ FileUpload
Returns a new instance of FileUpload.
4 5 6 7 8 |
# File 'lib/webspicy/file_upload.rb', line 4 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.
10 11 12 |
# File 'lib/webspicy/file_upload.rb', line 10 def content_type @content_type end |
#param_name ⇒ Object (readonly)
Returns the value of attribute param_name.
10 11 12 |
# File 'lib/webspicy/file_upload.rb', line 10 def param_name @param_name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/webspicy/file_upload.rb', line 10 def path @path end |
Class Method Details
.info(raw) ⇒ Object
12 13 14 |
# File 'lib/webspicy/file_upload.rb', line 12 def self.info(raw) new(raw) end |
Instance Method Details
#locate(resource) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/webspicy/file_upload.rb', line 16 def locate(resource) FileUpload.new({ path: resource.locate(path), content_type: content_type }) end |
#to_info ⇒ Object
23 24 25 26 27 |
# File 'lib/webspicy/file_upload.rb', line 23 def to_info { path: path.to_s, content_type: content_type, param_name: param_name } end |
#to_s ⇒ Object Also known as: inspect
29 30 31 |
# File 'lib/webspicy/file_upload.rb', line 29 def to_s "FileUpload(#{to_info})" end |