Class: IP21
- Inherits:
-
Object
- Object
- IP21
- Defined in:
- lib/ip21.rb
Overview
Aspentech IP21 Adapter for executing queries using SQLPlus
This library uses Windows Authentication for connecting to SQLPlus
Instance Method Summary collapse
-
#history(tag, start_time, end_time, opts = { limit: 1000, outsiders: 0, history_format: 0, retrieval_type: 0 }) ⇒ Hash
Fetch data from IP21 History.
-
#initialize(auth: { account: 'john.doe', domain: 'contoso.com', password: 'set_your_own_password' }, sqlplus_address: '127.0.0.1', ip21_address: '127.0.0.1', debug: false) ⇒ IP21
constructor
Initializes the connection.
- #kpi(tag) ⇒ Object
-
#query(sql, limit = 100) ⇒ Hash
Executes a direct query against the database.
Constructor Details
#initialize(auth: { account: 'john.doe', domain: 'contoso.com', password: 'set_your_own_password' }, sqlplus_address: '127.0.0.1', ip21_address: '127.0.0.1', debug: false) ⇒ IP21
Initializes the connection
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ip21.rb', line 30 def initialize( auth: { account: 'john.doe', domain: 'contoso.com', password: 'set_your_own_password' }, sqlplus_address: '127.0.0.1', ip21_address: '127.0.0.1', debug: false ) @account = auth[:account] @domain = auth[:domain] @password = auth[:password] @sqlplus_address = sqlplus_address @ip21_address = ip21_address @debug = debug end |
Instance Method Details
#history(tag, start_time, end_time, opts = { limit: 1000, outsiders: 0, history_format: 0, retrieval_type: 0 }) ⇒ Hash
Fetch data from IP21 History
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/ip21.rb', line 99 def history(tag, start_time, end_time, opts = { limit: 1000, outsiders: 0, history_format: 0, retrieval_type: 0 }) parse_rest( rest_request( 'History', history_query_body(tag, start_time, end_time, opts) ) ) end |
#kpi(tag) ⇒ Object
110 111 112 |
# File 'lib/ip21.rb', line 110 def kpi(tag) parse_rest(rest_request('KPI', kpi_query_body(tag))) end |
#query(sql, limit = 100) ⇒ Hash
Executes a direct query against the database
54 55 56 57 58 |
# File 'lib/ip21.rb', line 54 def query(sql, limit = 100) parse_rest( rest_request('SQL', sql_query_body(sql, limit)) ) end |