Class: GroqRuby::Multipart::Part
- Inherits:
-
Data
- Object
- Data
- GroqRuby::Multipart::Part
- Defined in:
- lib/groq_ruby/multipart.rb
Overview
A single field inside a multipart payload.
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.file(name, io:, filename:, content_type: "application/octet-stream") ⇒ Part
Build a file upload field.
-
.text(name, value) ⇒ Part
Build a plain text field.
Instance Method Summary collapse
-
#file? ⇒ Boolean
True if this part is a file upload (has a filename).
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type
18 19 20 |
# File 'lib/groq_ruby/multipart.rb', line 18 def content_type @content_type end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename
18 19 20 |
# File 'lib/groq_ruby/multipart.rb', line 18 def filename @filename end |
#name ⇒ Object (readonly)
Returns the value of attribute name
18 19 20 |
# File 'lib/groq_ruby/multipart.rb', line 18 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value
18 19 20 |
# File 'lib/groq_ruby/multipart.rb', line 18 def value @value end |
Class Method Details
.file(name, io:, filename:, content_type: "application/octet-stream") ⇒ Part
Build a file upload field.
33 34 35 |
# File 'lib/groq_ruby/multipart.rb', line 33 def self.file(name, io:, filename:, content_type: "application/octet-stream") new(name: name, value: io, filename: filename, content_type: content_type) end |
.text(name, value) ⇒ Part
Build a plain text field.
23 24 25 |
# File 'lib/groq_ruby/multipart.rb', line 23 def self.text(name, value) new(name: name, value: value.to_s, filename: nil, content_type: nil) end |
Instance Method Details
#file? ⇒ Boolean
Returns true if this part is a file upload (has a filename).
38 39 40 |
# File 'lib/groq_ruby/multipart.rb', line 38 def file? !filename.nil? end |