Class: KeytechKit::KeytechKit
- Inherits:
-
Object
- Object
- KeytechKit::KeytechKit
- Defined in:
- lib/keytechKit.rb
Overview
This class is the interface controller to the keytech Web API Use the helper functions to access various resources from the API
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#classes ⇒ Object
Returns the classes object.
-
#current_user ⇒ Object
Returns the login in user.
-
#data_dictionary_handler ⇒ Object
Returns the Data Dictionaries.
-
#element_handler ⇒ Object
Returns the Elements resource.
-
#initialize(baseurl, username = '', password = '') ⇒ KeytechKit
constructor
Initializes this class user
baseurl
,username
andpassword
to start accessing all other keytech API resources. -
#layouts ⇒ Object
TODO: Move Laoyuts under classes returns the layout class.
-
#search ⇒ Object
Returns the Search Object With the search you can start a fulltextsearch, search by field, type or access a predefined search on the server side for elements.
-
#serverinfo ⇒ Object
Returns the Serverinfo @see
ServerInfo
for details This should be always the first call whenever starting with keytech API.
Constructor Details
#initialize(baseurl, username = '', password = '') ⇒ KeytechKit
Initializes this class user baseurl
, username
and password
to start accessing all other keytech API resources
30 31 32 33 34 |
# File 'lib/keytechKit.rb', line 30 def initialize(baseurl, username = '', password = '') @base_url = baseurl @username = username @password = password end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
21 22 23 |
# File 'lib/keytechKit.rb', line 21 def base_url @base_url end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
23 24 25 |
# File 'lib/keytechKit.rb', line 23 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
22 23 24 |
# File 'lib/keytechKit.rb', line 22 def username @username end |
Instance Method Details
#classes ⇒ Object
Returns the classes object. A class in terms of keytech describes a type of elements. A class describes the attributes, its types and it supported layouts to make certain elements visible for a user.
77 78 79 80 |
# File 'lib/keytechKit.rb', line 77 def classes @classes = Classes.new(@base_url, @username, @password) if @classes.nil? @classes end |
#current_user ⇒ Object
Returns the login in user. This is always the user with which you Initialized this classes Check this object to see if the user is active and have API access.
49 50 51 52 53 54 55 |
# File 'lib/keytechKit.rb', line 49 def current_user if @_curent_user.nil? user = User.new(@base_url, @username, @password) @_curent_user = user.load(@username) end @_curent_user end |
#data_dictionary_handler ⇒ Object
Returns the Data Dictionaries. Data Dictionary (DD) will give lookup tables you will need to fill various element fields.
68 69 70 71 |
# File 'lib/keytechKit.rb', line 68 def data_dictionary_handler @data_dictionary_handler = DataDictionaryHandler.new(self, @base_url, @username, @password) if @data_dictionary_handler.nil? @data_dictionary_handler end |
#element_handler ⇒ Object
Returns the Elements resource. You will need to specify alwys the concrete Element you want to access. keytech API does not support to return bulk Lists of Elements
61 62 63 64 |
# File 'lib/keytechKit.rb', line 61 def element_handler @_element_handler = ElementHandler.new(self, @base_url, @username, @password) if @_element_handler.nil? @_element_handler end |
#layouts ⇒ Object
TODO: Move Laoyuts under classes returns the layout class. Eveny class can have a layout which describes the attribues with its type, acccess, datadictionary and if it is visible to the user.
86 87 88 89 |
# File 'lib/keytechKit.rb', line 86 def layouts @_layouts = Layouts.new(@base_url, @username, @password) if @_layouts.nil? @_layouts end |
#search ⇒ Object
Returns the Search Object With the search you can start a fulltextsearch, search by field, type or access a predefined search on the server side for elements
95 96 97 98 |
# File 'lib/keytechKit.rb', line 95 def search @_search = Search.new(@base_url, @username, @password) if @_search.nil? @_search end |
#serverinfo ⇒ Object
Returns the Serverinfo @see ServerInfo
for details This should be always the first call whenever starting with keytech API. ServerInfo will give valuable information about server access, version number and functions
41 42 43 44 |
# File 'lib/keytechKit.rb', line 41 def serverinfo @serverinfo_handler = ServerInfoHandler.new(self, @base_url) if @serverinfo_handler.nil? @serverinfo_handler.load end |