Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/aptible/api/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Api
class Account < Resource
belongs_to :stack

has_many :ai_tokens
has_many :apps
has_many :backups
has_many :certificates
Expand Down
39 changes: 39 additions & 0 deletions lib/aptible/api/ai_token.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module Aptible
module Api
class AiToken < Resource
belongs_to :account

field :id
field :name
field :created_at
field :updated_at
field :expires_at
field :last_used_at
field :revoked_at
field :gateway_url
# User (on whose behalf) details
field :created_by_user_id
field :created_by_user_name
field :created_by_user_email
# Actor (who performed) details
field :created_by_actor_id
field :created_by_actor_name
field :created_by_actor_email
# Revoked by user details
field :revoked_by_user_id
field :revoked_by_user_name
field :revoked_by_user_email
# Revoked by actor details
field :revoked_by_actor_id
field :revoked_by_actor_name
field :revoked_by_actor_email

# Note: The 'token' field from API response is accessible via
# attributes['token'] to avoid conflict with aptible-resource's
# internal token handling (used for auth bearer token)
def api_key
attributes['token']
end
end
end
end
1 change: 1 addition & 0 deletions lib/aptible/api/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def root_url
end

require 'aptible/api/account'
require 'aptible/api/ai_token'
require 'aptible/api/ami'
require 'aptible/api/ami_release'
require 'aptible/api/app'
Expand Down