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.0'

Class Method Summary collapse

Class Method Details

.get_element_by_id(element_name, id) ⇒ Object



119
120
121
122
123
124
125
126
# File 'lib/Appolo.rb', line 119

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



104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/Appolo.rb', line 104

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