Class: LogaltyCertificateIssuanceApiCerty::CertificateRequestsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/logalty_certificate_issuance_api_certy/apis/certificate_requests_api.rb

Overview

CertificateRequestsApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from LogaltyCertificateIssuanceApiCerty::BaseApi

Instance Method Details

#create_certificate_request(body) ⇒ ApiResponse

Registers a new certificate issuance request for an end-user. A synchronous access URL (‘accessUrl`) is always returned in the response. An asynchronous access link is also generated and sent to the end-user when `noticeMethod` is set to `EMAIL` or `SMS`. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/logalty_certificate_issuance_api_certy/apis/certificate_requests_api.rb', line 17

def create_certificate_request(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/lgt/signcloud/rest/api/v1/certificate/request',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TransactionResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Invalid request parameters.',
                             ErrorResponseException))
    .execute
end

#get_certificate_request_by_code(code) ⇒ ApiResponse

Returns the status and details of a certificate issuance transaction by its UUID. identifier in Logalty (UUIDv4 format).

Parameters:

  • code (UUID | String)

    Required parameter: Transaction’s unique

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/logalty_certificate_issuance_api_certy/apis/certificate_requests_api.rb', line 43

def get_certificate_request_by_code(code)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/lgt/signcloud/rest/api/v1/certificate/request/{code}',
                                 Server::DEFAULT)
               .template_param(new_parameter(code, key: 'code')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TransactionStatus.method(:from_hash))
                .is_api_response(true)
                .local_error('404',
                             'Transaction not found.',
                             ErrorResponseException))
    .execute
end

#get_certificate_request_by_external_id(external_id) ⇒ ApiResponse

Returns a list of certificate issuance transactions matching the provided external identifier. Multiple transactions may share the same ‘externalId` if registered with the `duplicateKeyOff` flag. client system external to Logalty.

Parameters:

  • external_id (String)

    Required parameter: Unique identifier in the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/logalty_certificate_issuance_api_certy/apis/certificate_requests_api.rb', line 70

def get_certificate_request_by_external_id(external_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/lgt/signcloud/rest/api/v1/certificate/request/external-id/{external-id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(external_id, key: 'external-id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('bearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TransactionStatus.method(:from_hash))
                .is_api_response(true)
                .is_response_array(true))
    .execute
end