Module: Appolo
- Defined in:
- lib/Appolo.rb,
lib/Appolo/version.rb
Overview
This module is the main provider for the public API that this gem provides.
Constant Summary collapse
- VERSION =
'2.0.3'
Class Method Summary collapse
-
.get_element_by_id(element_name, id) ⇒ Object
Call this method in order to get a single element.
-
.get_set_of_elements(element_name) ⇒ Object
Call this method in order to get an array of elements.
Class Method Details
.get_element_by_id(element_name, id) ⇒ Object
Call this method in order to get a single element. To specify which element to search you must specify element_name
as:
-
:students -> Set of Students
-
:teachers -> Set of Teachers
-
:classes -> Set of Classes
-
:programs -> Set of Programs
-
:courses -> Set of Courses
-
:lec_semesters -> Set of Lective Semesters
The id
specifies the id related to the element inside the Thoth API. _This gem is not responsible for the numbers used._
191 192 193 194 195 196 197 198 |
# File 'lib/Appolo.rb', line 191 def self.get_element_by_id(element_name, id) begin response = RestClient.get Api_Links[element_name] + id.to_s Builder_Element[element_name].call(response) rescue => e e end end |
.get_set_of_elements(element_name) ⇒ Object
Call this method in order to get an array of elements. To specify which element to search you must specify element_name
as:
-
:students -> Set of Students
-
:teachers -> Set of Teachers
-
:classes -> Set of Classes
-
:programs -> Set of Programs
-
:courses -> Set of Courses
-
:lec_semesters -> Set of Lective Semesters
163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/Appolo.rb', line 163 def self.get_set_of_elements(element_name) return Elements[element_name] unless Elements[element_name].length == 0 begin response = RestClient.get Api_Links[element_name] valid_resp = verify_response response element_api_codename = Api_Codename[element_name] set_of_elements = JSON.parse(valid_resp) set_of_elements = set_of_elements[element_api_codename] Builder_Elements[element_name].call(set_of_elements) Elements[element_name] rescue => e Elements[element_name] end end |