Class: Coinbase::ServerSigner
- Inherits:
-
Object
- Object
- Coinbase::ServerSigner
- Defined in:
- lib/coinbase/server_signer.rb
Overview
A representation of a Server-Signer. Server-Signers are assigned to sign transactions for a Wallet.
Defined Under Namespace
Modules: Status
Class Method Summary collapse
-
.default ⇒ Coinbase::ServerSigner
Returns the default ServerSigner for the CDP Project.
Instance Method Summary collapse
-
#id ⇒ String
Returns the Server-Signer ID.
-
#initialize(model) ⇒ ServerSigner
constructor
Returns a new Server-Signer object.
-
#inspect ⇒ String
Same as to_s.
-
#to_s ⇒ String
Returns a string representation of the Server-Signer.
-
#wallets ⇒ Array<String>
Returns the IDs of the Wallet's the Server-Signer can sign for.
Constructor Details
#initialize(model) ⇒ ServerSigner
Returns a new Server-Signer object. Do not use this method directly. Instead, use ServerSigner.default.
40 41 42 |
# File 'lib/coinbase/server_signer.rb', line 40 def initialize(model) @model = model end |
Class Method Details
.default ⇒ Coinbase::ServerSigner
Returns the default ServerSigner for the CDP Project.
22 23 24 25 26 27 28 29 30 |
# File 'lib/coinbase/server_signer.rb', line 22 def default response = Coinbase.call_api do server_signers_api.list_server_signers end raise 'No Server-Signer is associated with the project' if response.data.empty? new(response.data.first) end |
Instance Method Details
#id ⇒ String
Returns the Server-Signer ID.
46 47 48 |
# File 'lib/coinbase/server_signer.rb', line 46 def id @model.server_signer_id end |
#inspect ⇒ String
Same as to_s.
64 65 66 |
# File 'lib/coinbase/server_signer.rb', line 64 def inspect to_s end |
#to_s ⇒ String
Returns a string representation of the Server-Signer.
58 59 60 |
# File 'lib/coinbase/server_signer.rb', line 58 def to_s "Coinbase::ServerSigner{server_signer_id: '#{id}', wallets: [#{wallets.join(', ')}]}" end |
#wallets ⇒ Array<String>
Returns the IDs of the Wallet's the Server-Signer can sign for.
52 53 54 |
# File 'lib/coinbase/server_signer.rb', line 52 def wallets @model.wallets end |