Class: A2A::Part::Data
- Inherits:
-
Object
- Object
- A2A::Part::Data
- Defined in:
- lib/a2a/part/data.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data:, media_type: nil, filename: nil, metadata: nil) ⇒ Data
constructor
A new instance of Data.
- #to_h ⇒ Object
Constructor Details
#initialize(data:, media_type: nil, filename: nil, metadata: nil) ⇒ Data
Returns a new instance of Data.
8 9 10 11 12 13 |
# File 'lib/a2a/part/data.rb', line 8 def initialize(data:, media_type: nil, filename: nil, metadata: nil) @data = data @media_type = media_type @filename = filename @metadata = end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/a2a/part/data.rb', line 6 def data @data end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/a2a/part/data.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/data.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/data.rb', line 6 def @metadata end |
Class Method Details
.from_h(hash) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/a2a/part/data.rb', line 15 def self.from_h(hash) new( data: hash.fetch("data"), media_type: hash["mediaType"], filename: hash["filename"], metadata: hash["metadata"] ) end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/a2a/part/data.rb', line 24 def to_h { "data" => data, "mediaType" => media_type, "filename" => filename, "metadata" => }.compact end |