Module: Stats::RJR

Includes:
Omega, Omega::Server::DSL, Stats
Defined in:
lib/stats/rjr/get.rb,
lib/stats/rjr/init.rb

Overview

TODO batch stats retrieval mechanism

Constant Summary collapse

GET_METHODS =
{ :get_stats => get_stats }
PRIVILEGES =
[['view',   'manufactured_entities'],
['view',   'cosmos_entities'],
['view',   'users'],
['view',   'missions']]

Constants included from Stats

STATISTICS

Config options collapse

Config options collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Omega::Server::DSL

#check_attribute, #check_privilege, #cosmos_entity?, #current_session, #current_user, #delete_event_handler_for, #filter_properties, #filters_from_args, #from_valid_source?, #handle_node_closed, #in_subsystem, #is_cmd?, #is_node?, #login, #matching, #persistent_transport?, #remove_callbacks_for, #require_attribute, #require_persistent_transport!, #require_privilege, #require_state, #require_valid_source!, #subsystem, #subsystem_entity?, #subsystem_event?, #validate_session_source!, #with, #with_id

Methods included from Stats

get_stat

Class Attribute Details

.stats_rjr_passwordObject

Password to use to communicate w/ other modules over the local rjr node


29
30
31
# File 'lib/stats/rjr/init.rb', line 29

def stats_rjr_password
  @stats_rjr_password
end

.stats_rjr_usernameObject

User to use to communicate w/ other modules over the local rjr node


26
27
28
# File 'lib/stats/rjr/init.rb', line 26

def stats_rjr_username
  @stats_rjr_username
end

.universe_idObject

Unique universe identifier


23
24
25
# File 'lib/stats/rjr/init.rb', line 23

def universe_id
  @universe_id
end

Class Method Details

.nodeObject


67
68
69
# File 'lib/stats/rjr/init.rb', line 67

def self.node
  @node ||= ::RJR::Nodes::Local.new :node_id => self.user.id
end

.set_config(config) ⇒ Object

Set config options using Omega::Config instance


34
35
36
37
38
# File 'lib/stats/rjr/init.rb', line 34

def set_config(config)
  self.universe_id         = config.universe_id    || Motel.gen_uuid # XXX gen_uuid should be moved into omega/common
  self.stats_rjr_username  = config.stats_rjr_user
  self.stats_rjr_password  = config.stats_rjr_pass
end

.userObject


57
58
59
60
61
# File 'lib/stats/rjr/init.rb', line 57

def self.user
  @user ||= Users::User.new(:id       => Stats::RJR.stats_rjr_username,
                            :password => Stats::RJR.stats_rjr_password,
                            :registration_code => nil)
end

.user_registryObject


43
44
45
# File 'lib/stats/rjr/init.rb', line 43

def self.user_registry
  Users::RJR.registry
end

Instance Method Details

#nodeObject


71
72
73
# File 'lib/stats/rjr/init.rb', line 71

def node
  Stats::RJR.node
end

#userObject


63
64
65
# File 'lib/stats/rjr/init.rb', line 63

def user
  Stats::RJR.user
end

#user_registryObject


47
48
49
# File 'lib/stats/rjr/init.rb', line 47

def user_registry
  Stats::RJR.user_registry
end