Class: OmniAI::Google::Upload::File
- Inherits:
-
Object
- Object
- OmniAI::Google::Upload::File
- Defined in:
- lib/omniai/google/upload/file.rb
Overview
A file that can be used for generating chat completions.
Defined Under Namespace
Classes: DeleteError
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #delete! ⇒ Object
-
#initialize(client:, name:, uri:, state:, mime_type:) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(client:, name:, uri:, state:, mime_type:) ⇒ File
Returns a new instance of File.
45 46 47 48 49 50 51 |
# File 'lib/omniai/google/upload/file.rb', line 45 def initialize(client:, name:, uri:, state:, mime_type:) @client = client @name = name @uri = uri @state = state @mime_type = mime_type end |
Instance Attribute Details
#mime_type ⇒ String
24 25 26 |
# File 'lib/omniai/google/upload/file.rb', line 24 def mime_type @mime_type end |
#name ⇒ String
12 13 14 |
# File 'lib/omniai/google/upload/file.rb', line 12 def name @name end |
#state ⇒ String
20 21 22 |
# File 'lib/omniai/google/upload/file.rb', line 20 def state @state end |
#uri ⇒ String
16 17 18 |
# File 'lib/omniai/google/upload/file.rb', line 16 def uri @uri end |
Class Method Details
.parse(client:, data:) ⇒ File
30 31 32 33 34 35 36 37 38 |
# File 'lib/omniai/google/upload/file.rb', line 30 def self.parse(client:, data:) new( client: client, name: data['name'], uri: data['uri'], state: data['state'], mime_type: data['mimeType'] ) end |
Instance Method Details
#delete! ⇒ Object
54 55 56 57 58 59 |
# File 'lib/omniai/google/upload/file.rb', line 54 def delete! response = @client.connection .delete("/#{@client.version}/#{@name}", params: { key: @client.api_key }) raise DeleteError, response unless response.status.success? end |