Class: Specify::Service::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/specify/services/service.rb

Overview

Superclass for service classes.

Direct Known Subclasses

StubGenerator, ViewLoader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host:, database:, collection:, config:, specify_user: nil) ⇒ Service

Returns a new instance of Service


18
19
20
21
22
23
24
25
26
27
# File 'lib/specify/services/service.rb', line 18

def initialize(host:, database:, collection:, config:, specify_user: nil)
  @config = Configuration::DBConfig.new(host, database, config)
  @db = Database.new database, @config.connection
  session_user = specify_user || @config.session_user
  @session = @db.start_session session_user, collection
  @collection = @session.collection
  @discipline = @session.discipline
  @division = @session.division
  @agent = @session.session_agent
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent


7
8
9
# File 'lib/specify/services/service.rb', line 7

def agent
  @agent
end

#collectionObject (readonly)

The Specify::Model::Collection for #session.


10
11
12
# File 'lib/specify/services/service.rb', line 10

def collection
  @collection
end

#disciplineObject (readonly)

The Specify::Model::Discipline for #session.


13
14
15
# File 'lib/specify/services/service.rb', line 13

def discipline
  @discipline
end

#divisionObject (readonly)

Returns the value of attribute division


7
8
9
# File 'lib/specify/services/service.rb', line 7

def division
  @division
end

#sessionObject (readonly)

The Specify::Model::Session for the self.


16
17
18
# File 'lib/specify/services/service.rb', line 16

def session
  @session
end

Instance Method Details

#databaseObject


29
30
31
# File 'lib/specify/services/service.rb', line 29

def database
  @db.connection
end