Class: ApiConsumer

Inherits:
ApplicationRecord show all
Defined in:
app/models/api_consumer.rb

Overview

== Schema Information

Table name: api_consumers
Database name: primary

id :integer not null, primary key
api_key :string
api_version :string
application_type :string
name :string
created_at :datetime
updated_at :datetime

Indexes

index_api_consumers_on_api_key (api_key)
index_api_consumers_on_api_version (api_version)
index_api_consumers_on_application_type (application_type)
index_api_consumers_on_name (name)

Constant Summary

Constants included from Schedulable

Schedulable::SIMPLE_FORM_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Schedulable

config

Methods included from Models::AfterCommittable

#after_commit

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#api_versionObject (readonly)

has_many :api_access_statistics

Validations:



25
# File 'app/models/api_consumer.rb', line 25

validates :name, :api_version, :application_type, presence: true

#application_typeObject (readonly)

has_many :api_access_statistics

Validations:



25
# File 'app/models/api_consumer.rb', line 25

validates :name, :api_version, :application_type, presence: true

#nameObject (readonly)

has_many :api_access_statistics

Validations:



25
# File 'app/models/api_consumer.rb', line 25

validates :name, :api_version, :application_type, presence: true

Instance Method Details

#generate_api_keyObject



29
30
31
# File 'app/models/api_consumer.rb', line 29

def generate_api_key
  update_attribute(:api_key, Encryption.encrypt_string(id.to_s))
end