Class: Virgil::SDK::HighLevel::VirgilApi
- Inherits:
-
Object
- Object
- Virgil::SDK::HighLevel::VirgilApi
- Defined in:
- lib/virgil/sdk/high_level/virgil_api.rb
Overview
The VirgilApi class is a high-level API that provides easy access to Virgil Security services and allows to perform cryptographic operations by using two domain entities VirgilKey and VirgilCard. Where the VirgilKey is an entity that represents a user's Private key, and the VirgilCard is the entity that represents user's identity and a Public key.
Defined Under Namespace
Classes: VirgilApiAccessTokenException, VirgilApiException
Instance Attribute Summary collapse
-
#cards ⇒ VirgilCardManager
Virgil Card Manager that provides a work with VirgilCard entities.
-
#context ⇒ VirgilContext
Virgil Context that manages the VirgilApi dependencies during run time.
-
#keys ⇒ VirgilKeyManager
Virgil Key Manager that provides a work with VirgilKey entities.
Instance Method Summary collapse
-
#initialize(access_token: nil, context: nil) ⇒ VirgilApi
constructor
Initializes a new instance of the VirgilApi class.
Constructor Details
#initialize(access_token: nil, context: nil) ⇒ VirgilApi
The both of the arguments(access_token and context) are not required for actions with Global cards.
Initializes a new instance of the Virgil::SDK::HighLevel::VirgilApi class.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/virgil/sdk/high_level/virgil_api.rb', line 94 def initialize(access_token: nil, context: nil) if (access_token && context) raise VirgilApiAccessTokenException.new unless access_token == context.access_token end if context self.context = context else self.context = Virgil::SDK::HighLevel::VirgilContext.new(access_token: access_token) end self.keys = VirgilKeyManager.new(self.context) self.cards = VirgilCardManager.new(self.context) end |
Instance Attribute Details
#cards ⇒ VirgilCardManager
Virgil Card Manager that provides a work with VirgilCard entities.
55 56 57 |
# File 'lib/virgil/sdk/high_level/virgil_api.rb', line 55 def cards @cards end |
#context ⇒ VirgilContext
Virgil Context that manages the VirgilApi dependencies during run time.
47 48 49 |
# File 'lib/virgil/sdk/high_level/virgil_api.rb', line 47 def context @context end |
#keys ⇒ VirgilKeyManager
Virgil Key Manager that provides a work with VirgilKey entities.
51 52 53 |
# File 'lib/virgil/sdk/high_level/virgil_api.rb', line 51 def keys @keys end |