Class: A2A::Part::File
- Inherits:
-
Object
- Object
- A2A::Part::File
- Defined in:
- lib/a2a/part/file.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#media_type ⇒ Object
readonly
Returns the value of attribute media_type.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw: nil, url: nil, filename: nil, media_type: nil, metadata: nil) ⇒ File
constructor
A new instance of File.
- #inline? ⇒ Boolean
- #remote? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(raw: nil, url: nil, filename: nil, media_type: nil, metadata: nil) ⇒ File
Returns a new instance of File.
8 9 10 11 12 13 14 |
# File 'lib/a2a/part/file.rb', line 8 def initialize(raw: nil, url: nil, filename: nil, media_type: nil, metadata: nil) @raw = raw @url = url @filename = filename @media_type = media_type @metadata = end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/a2a/part/file.rb', line 6 def filename @filename end |
#media_type ⇒ Object (readonly)
Returns the value of attribute media_type.
6 7 8 |
# File 'lib/a2a/part/file.rb', line 6 def media_type @media_type end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/a2a/part/file.rb', line 6 def @metadata end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/a2a/part/file.rb', line 6 def raw @raw end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/a2a/part/file.rb', line 6 def url @url end |
Class Method Details
.from_h(hash) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/a2a/part/file.rb', line 16 def self.from_h(hash) new( raw: hash["raw"], url: hash["url"], filename: hash["filename"], media_type: hash["mediaType"], metadata: hash["metadata"] ) end |
Instance Method Details
#inline? ⇒ Boolean
36 37 38 |
# File 'lib/a2a/part/file.rb', line 36 def inline? !raw.nil? end |
#remote? ⇒ Boolean
40 41 42 |
# File 'lib/a2a/part/file.rb', line 40 def remote? !url.nil? end |
#to_h ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/a2a/part/file.rb', line 26 def to_h { "raw" => raw, "url" => url, "filename" => filename, "mediaType" => media_type, "metadata" => }.compact end |