RUBYCRITIC
# == Schema Information
#
# Table name: accounts
#
# id :bigint not null, primary key
# ai_usage :jsonb not null
# currency_code :string default("BRL"), not null
# name :string default(""), not null
# number_of_employees :string default("1-10"), not null
# segment :string default("other"), not null
# settings :jsonb not null
# site_url :string default(""), not null
# woofbot_auto_reply :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#
class Account < ApplicationRecord - Account has at least 18 methods
include Account::Settings
validates :name, presence: true
validates :name, length: { maximum: 255 }
validates :currency_code, presence: true, inclusion: { in: Money::Currency.table.keys.map(&:to_s).map(&:upcase) }
enum segment: {
technology: 'technology',
health: 'health',
finance: 'finance',
education: 'education',
retail: 'retail',
services: 'services',
manufacturing: 'manufacturing',
telecommunications: 'telecommunications',
transportation_logistics: 'transportation_logistics',
real_estate: 'real_estate',
energy: 'energy',
agriculture: 'agriculture',
tourism_hospitality: 'tourism_hospitality',
entertainment_media: 'entertainment_media',
construction: 'construction',
public_sector: 'public_sector',
consulting: 'consulting',
startup: 'startup',
ecommerce: 'ecommerce',
security: 'security',
automotive: 'automotive',
other: 'other'
}
enum number_of_employees: {
'1-10' => '1-10',
'11-50' => '11-50',
'51-200' => '51-200',
'201-500' => '201-500',
'501+' => '501+'
}
def events - Account#events doesn't depend on instance state (maybe move it to another class?)
Event.all
end
def apps - Account#apps doesn't depend on instance state (maybe move it to another class?)
App.all
end
def users - Account#users doesn't depend on instance state (maybe move it to another class?)
User.all
end
def contacts - Account#contacts doesn't depend on instance state (maybe move it to another class?)
Contact.all
end
def deals - Account#deals doesn't depend on instance state (maybe move it to another class?)
Deal.all
end
def custom_attribute_definitions - Account#custom_attribute_definitions doesn't depend on instance state (maybe move it to another class?)
CustomAttributeDefinition.all
end
def custom_attributes_definitions
custom_attribute_definitions
end
def apps_wpp_connects - Account#apps_wpp_connects doesn't depend on instance state (maybe move it to another class?)
Apps::WppConnect.all
end
def apps_chatwoots - Account#apps_chatwoots doesn't depend on instance state (maybe move it to another class?)
Apps::Chatwoot.all
end
def apps_evolution_apis - Account#apps_evolution_apis doesn't depend on instance state (maybe move it to another class?)
Apps::EvolutionApi.all
end
def webhooks - Account#webhooks doesn't depend on instance state (maybe move it to another class?)
Webhook.all
end
def stages - Account#stages doesn't depend on instance state (maybe move it to another class?)
Stage.all
end
def products - Account#products doesn't depend on instance state (maybe move it to another class?)
Product.all
end
def embedding_documments - Account#embedding_documments doesn't depend on instance state (maybe move it to another class?)
EmbeddingDocumment.all
end
def deal_products - Account#deal_products doesn't depend on instance state (maybe move it to another class?)
DealProduct.all
end
def apps_ai_assistents - Account#apps_ai_assistents doesn't depend on instance state (maybe move it to another class?)
Apps::AiAssistent.all
end
def site_url=(url)
super(normalize_url(url))
end
def normalize_url(url) - Account#normalize_url doesn't depend on instance state (maybe move it to another class?)
url = "https://#{url}" unless url.match?(%r{\Ahttp(s)?://})
url
end
end