Class: Cadenya::Types::AIProviderCredential_ApiKey

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, api_key: nil) ⇒ AIProviderCredential_ApiKey

Returns a new instance of AIProviderCredential_ApiKey.



9256
9257
9258
9259
# File 'lib/cadenya/types.rb', line 9256

def initialize(type: nil, api_key: nil)
  @type = type
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



9254
9255
9256
# File 'lib/cadenya/types.rb', line 9254

def api_key
  @api_key
end

#typeObject (readonly)

Returns the value of attribute type.



9254
9255
9256
# File 'lib/cadenya/types.rb', line 9254

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



9261
9262
9263
9264
9265
9266
# File 'lib/cadenya/types.rb', line 9261

def self.from_json(data)
  new(
    type: data["type"],
    api_key: data["apiKey"].nil? ? nil : Types::CredentialAPIKey.from_json(data["apiKey"]),
  )
end

Instance Method Details

#to_hObject



9268
9269
9270
9271
9272
9273
# File 'lib/cadenya/types.rb', line 9268

def to_h
  {
    type: Util.plain(@type),
    api_key: Util.plain(@api_key),
  }.reject { |_k, v| v.nil? }
end