Class: FfcrmEndpoint::Endpoint
- Inherits:
-
Object
- Object
- FfcrmEndpoint::Endpoint
- Defined in:
- lib/ffcrm_endpoint/endpoint.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
-
#request ⇒ Object
Returns the value of attribute request.
Instance Method Summary collapse
-
#authenticate ⇒ Object
The authentication method is called by the endpoint controller before ‘process’ is run.
-
#initialize(request) ⇒ Endpoint
constructor
A new instance of Endpoint.
-
#process ⇒ Object
The main function to process the incoming data.
Constructor Details
#initialize(request) ⇒ Endpoint
Returns a new instance of Endpoint.
14 15 16 17 18 |
# File 'lib/ffcrm_endpoint/endpoint.rb', line 14 def initialize(request) @request = request @params = request.params raise EndpointNoActionError, "No action defined." unless params[:klass_name].present? end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/ffcrm_endpoint/endpoint.rb', line 9 def params @params end |
#request ⇒ Object
Returns the value of attribute request.
9 10 11 |
# File 'lib/ffcrm_endpoint/endpoint.rb', line 9 def request @request end |
Instance Method Details
#authenticate ⇒ Object
The authentication method is called by the endpoint controller before ‘process’ is run. ‘process’ will only be called if authenticate returns true
30 31 32 |
# File 'lib/ffcrm_endpoint/endpoint.rb', line 30 def authenticate klass.new(request).authenticate == true end |
#process ⇒ Object
The main function to process the incoming data. It delegates to the process function in your custom endpoint class.
23 24 25 |
# File 'lib/ffcrm_endpoint/endpoint.rb', line 23 def process klass.new(request).process end |