Class: Unit::Resource::ApplicationFormResource

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/unit/api_resources/application_form_resource.rb

Class Method Summary collapse

Methods inherited from BaseResource

file_response_handler, response_handler

Class Method Details

.create_application_form(request) ⇒ UnitResponse, UnitError

Create a new application form by calling Unit’s API

Parameters:

  • request (CreateApplicationFormRequest)

    request

Returns:



16
17
18
19
20
# File 'lib/unit/api_resources/application_form_resource.rb', line 16

def create_application_form(request)
  payload = request.to_json_api
  response = HttpHelper.post("#{api_url}/application-forms", body: payload, headers: headers)
  response_handler(response)
end

.get_application_form(application_form_id) ⇒ UnitResponse, UnitError

Get application form by calling Unit’s API

Parameters:

  • application_form_id (String)

Returns:



25
26
27
28
# File 'lib/unit/api_resources/application_form_resource.rb', line 25

def get_application_form(application_form_id)
  response = HttpHelper.get("#{api_url}/application-forms/#{application_form_id}", headers: headers)
  response_handler(response)
end

.list_application_forms(params = nil) ⇒ UnitResponse, UnitError

List application forms by calling Unit’s API

Parameters:

  • params (ListApplicationFormParams) (defaults to: nil)

Returns:



33
34
35
36
# File 'lib/unit/api_resources/application_form_resource.rb', line 33

def list_application_forms(params = nil)
  response = HttpHelper.get("#{api_url}/application-forms", headers: headers, params: params.to_hash)
  response_handler(response)
end