Class: Ronin::DB::Organization

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Model, Model::HasName, Model::Importable
Defined in:
lib/ronin/db/organization.rb

Overview

Represents an Company.

Instance Attribute Summary collapse

Attributes included from Model::HasName

#name

Class Method Summary collapse

Methods included from Model::Importable

included

Methods included from Model::HasName

included

Methods included from Model

included

Instance Attribute Details

#created_atTime (readonly)

Tracks when the organization was first created

Returns:

  • (Time)


63
# File 'lib/ronin/db/organization.rb', line 63

attribute :created_at, :datetime

#customer_organizationsArray<Organization>

The other customer organizations (B2B) of the organization.

Returns:

Since:

  • 0.2.0



177
# File 'lib/ronin/db/organization.rb', line 177

has_many :customer_organizations, through: :organization_customers

#customersArray<Person>

The individual customers (B2C) of the organization/

Returns:

Since:

  • 0.2.0



169
# File 'lib/ronin/db/organization.rb', line 169

has_many :customers, through: :organization_customers

#departmentsArray<OrganizationDepartment>

The associated departments of the organization.

Returns:

Since:

  • 0.2.0



133
134
# File 'lib/ronin/db/organization.rb', line 133

has_many :departments, class_name: 'OrganizationDepartment',
dependent:  :destroy

#host_namesArray<HostName>

The host names that the organization owns.

Returns:

Since:

  • 0.2.0



211
# File 'lib/ronin/db/organization.rb', line 211

has_many :host_names, through: :organization_host_names

#idInteger

Primary key of the organization

Returns:

  • (Integer)


45
# File 'lib/ronin/db/organization.rb', line 45

attribute :id, :integer

#ip_addressesArray<IPAddress>

The IP addresses that the organization owns.

Returns:

Since:

  • 0.2.0



228
# File 'lib/ronin/db/organization.rb', line 228

has_many :ip_addresses, through: :organization_ip_addresses

#member_email_addressesArray<EmailAddress>

The email addresses used by members of the organization.

Returns:

Since:

  • 0.2.0



150
151
# File 'lib/ronin/db/organization.rb', line 150

has_many :member_email_addresses, through: :members,
source:  :email_address

#membersArray<OrganizationMember>

The members that belong to the organization.

Returns:

Since:

  • 0.2.0



142
# File 'lib/ronin/db/organization.rb', line 142

has_many :members, class_name: 'OrganizationMember'

#notesArray<Note>

The associated notes.

Returns:

Since:

  • 0.2.0



236
# File 'lib/ronin/db/organization.rb', line 236

has_many :notes, dependent: :destroy

#organization_customersArray<OrganizationCustomer>

The organization's customer relationships.

Returns:

Since:

  • 0.2.0



159
160
161
# File 'lib/ronin/db/organization.rb', line 159

has_many :organization_customers, class_name:  'OrganizationCustomer',
foreign_key: :vendor_id,
dependent:   :destroy

#organization_email_addressesArray<EmailAddress>

The email addresses directly associated directly with the organization.

Returns:

Since:

  • 0.2.0



116
# File 'lib/ronin/db/organization.rb', line 116

has_many :organization_email_addresses, dependent: :destroy

#organization_host_namesArray<OrganizationHostName>

The association of organizations and host names.

Returns:

Since:

  • 0.2.0



203
# File 'lib/ronin/db/organization.rb', line 203

has_many :organization_host_names, dependent: :destroy

#organization_ip_addressesArray<OrganizationIPAddress>

The association of organizations and IP addresses.

Returns:

Since:

  • 0.2.0



219
220
# File 'lib/ronin/db/organization.rb', line 219

has_many :organization_ip_addresses, class_name: 'OrganizationIPAddress',
dependent:  :destroy

#organization_phone_numbersArray<OrganizationPhoneNumber>

The association of phone numbers associated with the organization.

Returns:

Since:

  • 0.2.0



99
# File 'lib/ronin/db/organization.rb', line 99

has_many :organization_phone_numbers, dependent: :destroy

#organization_street_addressesArray<OrganizationStreetAddress>

The association of street addresses associated with the organization.

Returns:

Since:

  • 0.2.0



83
# File 'lib/ronin/db/organization.rb', line 83

has_many :organization_street_addresses, dependent: :destroy

#parentOrganization?

The optional parent organization.

Returns:

Since:

  • 0.2.0



71
72
# File 'lib/ronin/db/organization.rb', line 71

belongs_to :parent, optional:   true,
class_name: 'Organization'

#phone_numbersArray<PhoneNumber>

The phone numbers that are associated with the organization.

Returns:

Since:

  • 0.2.0



107
# File 'lib/ronin/db/organization.rb', line 107

has_many :phone_numbers, through: :organization_phone_numbers

#street_addressesArray<StreetAddress>

The street addresses that are associated with the organization.

Returns:

Since:

  • 0.2.0



91
# File 'lib/ronin/db/organization.rb', line 91

has_many :street_addresses, through: :organization_street_addresses

#type"company", ...

The type for the organization.

Returns:

  • ("company", "government", "military", nil)

Since:

  • 0.2.0



53
54
55
56
57
# File 'lib/ronin/db/organization.rb', line 53

enum :type, {
  company:    'company',
  government: 'government',
  military:   'military'
}, prefix: 'is_'

#vendor_relationshipsArray<OrganizationCustomer>

The organization's vendor relationships with other organizations.

Returns:

Since:

  • 0.2.0



185
186
187
# File 'lib/ronin/db/organization.rb', line 185

has_many :organization_vendors, class_name:  'OrganizationCustomer',
foreign_key: :customer_organization_id,
dependent:   :destroy

#vendorsArray<Organization>

The vendor companies that the organization is a customer of.

Returns:

Since:

  • 0.2.0



195
# File 'lib/ronin/db/organization.rb', line 195

has_many :vendors, through: :organization_vendors

Class Method Details

.import(name) ⇒ Organization

Imports an organization.

Parameters:

  • name (String)

    The organization name to import.

Returns:

Since:

  • 0.2.0



268
269
270
# File 'lib/ronin/db/organization.rb', line 268

def self.import(name)
  create(name: name)
end

.lookup(name) ⇒ Organization?

Looks up the organization.

Parameters:

  • name (String)

    The organization name to query.

Returns:

Since:

  • 0.2.0



251
252
253
# File 'lib/ronin/db/organization.rb', line 251

def self.lookup(name)
  find_by(name: name)
end