Class: FfcrmEndpoint::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/ffcrm_endpoint/endpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Endpoint

Returns a new instance of Endpoint.



14
15
16
17
# File 'lib/ffcrm_endpoint/endpoint.rb', line 14

def initialize(params)
  @params = params
  raise EndpointNoActionError, "No action defined." unless params[:klass_name].present?
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



9
10
11
# File 'lib/ffcrm_endpoint/endpoint.rb', line 9

def params
  @params
end

Instance Method Details

#authenticateObject

The authentication method is called by the endpoint controller before ‘process’ is run. ‘process’ will only be called if authenticate returns true



29
30
31
# File 'lib/ffcrm_endpoint/endpoint.rb', line 29

def authenticate
  klass.new(params).authenticate == true
end

#processObject

The main function to process the incoming data. It delegates to the process function in your custom endpoint class.



22
23
24
# File 'lib/ffcrm_endpoint/endpoint.rb', line 22

def process
  klass.new(params).process
end