Class: Vapi::HmacAuthenticationPlan
- Inherits:
-
Object
- Object
- Vapi::HmacAuthenticationPlan
- Defined in:
- lib/vapi_server_sdk/types/hmac_authentication_plan.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#algorithm ⇒ Vapi::HmacAuthenticationPlanAlgorithm
readonly
This is the HMAC algorithm to use for signing.
-
#include_timestamp ⇒ Boolean
readonly
Whether to include a timestamp in the signature payload.
-
#message_id_header ⇒ String
readonly
This is the header name where the unique message ID will be sent.
-
#payload_format ⇒ String
readonly
Custom payload format.
-
#secret_is_base_64 ⇒ Boolean
readonly
Whether the secret key is base64-encoded and should be decoded before use.
-
#secret_key ⇒ String
readonly
This is the HMAC secret key used to sign requests.
-
#signature_encoding ⇒ Vapi::HmacAuthenticationPlanSignatureEncoding
readonly
The encoding format for the signature.
-
#signature_header ⇒ String
readonly
This is the header name where the signature will be sent.
-
#signature_prefix ⇒ String
readonly
This is the prefix for the signature.
-
#timestamp_header ⇒ String
readonly
This is the header name where the timestamp will be sent.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::HmacAuthenticationPlan
Deserialize a JSON object to an instance of HmacAuthenticationPlan.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(secret_key:, algorithm:, signature_header: OMIT, timestamp_header: OMIT, signature_prefix: OMIT, include_timestamp: OMIT, payload_format: OMIT, message_id_header: OMIT, signature_encoding: OMIT, secret_is_base_64: OMIT, additional_properties: nil) ⇒ Vapi::HmacAuthenticationPlan constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of HmacAuthenticationPlan to a JSON object.
Constructor Details
#initialize(secret_key:, algorithm:, signature_header: OMIT, timestamp_header: OMIT, signature_prefix: OMIT, include_timestamp: OMIT, payload_format: OMIT, message_id_header: OMIT, signature_encoding: OMIT, secret_is_base_64: OMIT, additional_properties: nil) ⇒ Vapi::HmacAuthenticationPlan
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 64 def initialize(secret_key:, algorithm:, signature_header: OMIT, timestamp_header: OMIT, signature_prefix: OMIT, include_timestamp: OMIT, payload_format: OMIT, message_id_header: OMIT, signature_encoding: OMIT, secret_is_base_64: OMIT, additional_properties: nil) @secret_key = secret_key @algorithm = algorithm @signature_header = signature_header if signature_header != OMIT = if != OMIT @signature_prefix = signature_prefix if signature_prefix != OMIT = if != OMIT @payload_format = payload_format if payload_format != OMIT = if != OMIT @signature_encoding = signature_encoding if signature_encoding != OMIT @secret_is_base_64 = secret_is_base_64 if secret_is_base_64 != OMIT @additional_properties = additional_properties @_field_set = { "secretKey": secret_key, "algorithm": algorithm, "signatureHeader": signature_header, "timestampHeader": , "signaturePrefix": signature_prefix, "includeTimestamp": , "payloadFormat": payload_format, "messageIdHeader": , "signatureEncoding": signature_encoding, "secretIsBase64": secret_is_base_64 }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
38 39 40 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 38 def additional_properties @additional_properties end |
#algorithm ⇒ Vapi::HmacAuthenticationPlanAlgorithm (readonly)
Returns This is the HMAC algorithm to use for signing.
13 14 15 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 13 def algorithm @algorithm end |
#include_timestamp ⇒ Boolean (readonly)
Returns Whether to include a timestamp in the signature payload. Defaults to true.
24 25 26 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 24 def end |
#message_id_header ⇒ String (readonly)
Returns This is the header name where the unique message ID will be sent. Used for Svix-style webhooks.
31 32 33 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 31 def end |
#payload_format ⇒ String (readonly)
Returns Custom payload format. Use body for request body, timestamp for timestamp, method for HTTP method, url for URL, svix-id for unique message ID. Defaults to ‘timestamp.body’.
28 29 30 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 28 def payload_format @payload_format end |
#secret_is_base_64 ⇒ Boolean (readonly)
Returns Whether the secret key is base64-encoded and should be decoded before use. Defaults to false.
36 37 38 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 36 def secret_is_base_64 @secret_is_base_64 end |
#secret_key ⇒ String (readonly)
Returns This is the HMAC secret key used to sign requests.
11 12 13 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 11 def secret_key @secret_key end |
#signature_encoding ⇒ Vapi::HmacAuthenticationPlanSignatureEncoding (readonly)
Returns The encoding format for the signature. Defaults to ‘hex’.
33 34 35 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 33 def signature_encoding @signature_encoding end |
#signature_header ⇒ String (readonly)
Returns This is the header name where the signature will be sent. Defaults to ‘x-signature’.
16 17 18 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 16 def signature_header @signature_header end |
#signature_prefix ⇒ String (readonly)
Returns This is the prefix for the signature. For example, ‘sha256=’ for GitHub-style signatures.
22 23 24 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 22 def signature_prefix @signature_prefix end |
#timestamp_header ⇒ String (readonly)
Returns This is the header name where the timestamp will be sent. Defaults to ‘x-timestamp’.
19 20 21 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 19 def end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::HmacAuthenticationPlan
Deserialize a JSON object to an instance of HmacAuthenticationPlan
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 97 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) secret_key = parsed_json["secretKey"] algorithm = parsed_json["algorithm"] signature_header = parsed_json["signatureHeader"] = parsed_json["timestampHeader"] signature_prefix = parsed_json["signaturePrefix"] = parsed_json["includeTimestamp"] payload_format = parsed_json["payloadFormat"] = parsed_json["messageIdHeader"] signature_encoding = parsed_json["signatureEncoding"] secret_is_base_64 = parsed_json["secretIsBase64"] new( secret_key: secret_key, algorithm: algorithm, signature_header: signature_header, timestamp_header: , signature_prefix: signature_prefix, include_timestamp: , payload_format: payload_format, message_id_header: , signature_encoding: signature_encoding, secret_is_base_64: secret_is_base_64, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 138 def self.validate_raw(obj:) obj.secret_key.is_a?(String) != false || raise("Passed value for field obj.secret_key is not the expected type, validation failed.") obj.algorithm.is_a?(Vapi::HmacAuthenticationPlanAlgorithm) != false || raise("Passed value for field obj.algorithm is not the expected type, validation failed.") obj.signature_header&.is_a?(String) != false || raise("Passed value for field obj.signature_header is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.timestamp_header is not the expected type, validation failed.") obj.signature_prefix&.is_a?(String) != false || raise("Passed value for field obj.signature_prefix is not the expected type, validation failed.") obj.&.is_a?(Boolean) != false || raise("Passed value for field obj.include_timestamp is not the expected type, validation failed.") obj.payload_format&.is_a?(String) != false || raise("Passed value for field obj.payload_format is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.message_id_header is not the expected type, validation failed.") obj.signature_encoding&.is_a?(Vapi::HmacAuthenticationPlanSignatureEncoding) != false || raise("Passed value for field obj.signature_encoding is not the expected type, validation failed.") obj.secret_is_base_64&.is_a?(Boolean) != false || raise("Passed value for field obj.secret_is_base_64 is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of HmacAuthenticationPlan to a JSON object
128 129 130 |
# File 'lib/vapi_server_sdk/types/hmac_authentication_plan.rb', line 128 def to_json(*_args) @_field_set&.to_json end |