Class: ScaleEngineAPI
- Inherits:
-
Object
- Object
- ScaleEngineAPI
- Defined in:
- lib/scaleengine.rb,
lib/scaleengine/request.rb,
lib/scaleengine/version.rb,
lib/scaleengine/response.rb,
lib/scaleengine/configuration.rb
Defined Under Namespace
Classes: APIException, Configuration, InvalidParamsException, MissingIdException, Request, Response
Constant Summary collapse
- VERSION =
The version of the gem
'0.1.5'
Instance Method Summary collapse
-
#method_missing(method, *args) ⇒ Object
Normal API methods found under the API documentation at cp.scaleengine.net/docs/api.
-
#record_control(action, params) ⇒ Object
Specific endpoint for record_controls action.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
Normal API methods found under the API documentation at cp.scaleengine.net/docs/api
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/scaleengine.rb', line 24 def method_missing(method, *args) params = args[0].is_a?(Hash) ? args[0] : {} # Set the vairous params that are required for each test params[:command] = "#{method}" params[:api_key] = Configuration.api_key params[:cdn] = Configuration.cdn Request.new(Configuration.api_end_point, params) end |
Instance Method Details
#record_control(action, params) ⇒ Object
Specific endpoint for record_controls action
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/scaleengine.rb', line 10 def record_control(action, params) if not params.is_a?(Hash) # Invalid params type. Not a hash raise InvalidParamsException.new("Params must be hash") elsif action.blank? # Missing action raise InvalidParamsException.new("Action must not be empty") end params[:action] = action Request.new(Configuration.record_control_end_point, params) end |