Class: Virgil::SDK::Client::Requests::RevokeCardRequest

Inherits:
SignableRequest show all
Defined in:
lib/virgil/sdk/client/requests/revoke_card_request.rb

Overview

Revoke card signable API request.

Direct Known Subclasses

DeleteRelationRequest

Defined Under Namespace

Classes: Reasons

Instance Attribute Summary collapse

Attributes inherited from SignableRequest

#relations, #signatures, #snapshot, #validation_token

Instance Method Summary collapse

Methods inherited from SignableRequest

#export, #request_model, #sign_with, #take_snapshot

Constructor Details

#initialize(attributes) ⇒ RevokeCardRequest

Constructs new CreateCardRequest object.



53
54
55
56
57
# File 'lib/virgil/sdk/client/requests/revoke_card_request.rb', line 53

def initialize(attributes)
  super()
  self.card_id = attributes[:card_id]
  self.reason = attributes[:reason] || Reasons::Unspecified
end

Instance Attribute Details

#card_idObject

Returns the value of attribute card_id



49
50
51
# File 'lib/virgil/sdk/client/requests/revoke_card_request.rb', line 49

def card_id
  @card_id
end

#reasonObject

Returns the value of attribute reason



49
50
51
# File 'lib/virgil/sdk/client/requests/revoke_card_request.rb', line 49

def reason
  @reason
end

Instance Method Details

#restore(validation_token) ⇒ Object



66
67
68
# File 'lib/virgil/sdk/client/requests/revoke_card_request.rb', line 66

def restore(validation_token)
  @validation_token = validation_token
end

#restore_from_snapshot_model(snapshot_model) ⇒ Object

Restores request from snapshot model.

Parameters:

  • snapshot_model (Hash)

    snapshot model.



61
62
63
64
# File 'lib/virgil/sdk/client/requests/revoke_card_request.rb', line 61

def restore_from_snapshot_model(snapshot_model)
  self.card_id = snapshot_model['card_id']
  self.reason = snapshot_model['revocation_reason']
end

#snapshot_modelHash

Constructs snapshot model for exporting and signing.

Returns:

  • (Hash)

    Dict containing snapshot data model used for card creation request.



73
74
75
76
77
78
# File 'lib/virgil/sdk/client/requests/revoke_card_request.rb', line 73

def snapshot_model
  return {
    'card_id': self.card_id,
    'revocation_reason': self.reason,
  }
end