Class: AhoSdk::Issuer::CredentialsResource Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aho_sdk/issuer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Credentials resource operations

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ CredentialsResource

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CredentialsResource.



160
161
162
# File 'lib/aho_sdk/issuer.rb', line 160

def initialize(client)
  @client = client
end

Instance Method Details

#create(body: nil, idempotency_key: nil) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Issue a new credential

Returns:

  • (Hash)


167
168
169
# File 'lib/aho_sdk/issuer.rb', line 167

def create(body: nil, idempotency_key: nil)
  @client.post("/v1/issuer/credentials", body: body, idempotency_key: idempotency_key)
end

#get(uuid:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get issued credential details

Returns:

  • (Hash)


185
186
187
# File 'lib/aho_sdk/issuer.rb', line 185

def get(uuid:)
  @client.get("/v1/issuer/credentials/#{uuid}")
end

#history(uuid:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get credential history

Returns:

  • (Hash)


220
221
222
# File 'lib/aho_sdk/issuer.rb', line 220

def history(uuid:)
  @client.get("/v1/issuer/credentials/#{uuid}/history")
end

#list(status: nil, schema: nil, subject_identifier: nil, issued_after: nil, issued_before: nil, expires_after: nil, expires_before: nil, sort: "issued_at", direction: "desc", page: 1, per_page: 25) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

List credentials

Returns:

  • (Hash)


174
175
176
177
178
179
180
# File 'lib/aho_sdk/issuer.rb', line 174

def list(status: nil, schema: nil, subject_identifier: nil, issued_after: nil, issued_before: nil, expires_after: nil, expires_before: nil, sort: "issued_at", direction: "desc", page: 1, per_page: 25)
  fetch_page = ->(p) {
    response = @client.get("/v1/issuer/credentials", params: { status: status, schema: schema, subject_identifier: subject_identifier, issued_after: issued_after, issued_before: issued_before, expires_after: expires_after, expires_before: expires_before, sort: sort, direction: direction, page: p, per_page: per_page })
    Page.new(data: response[:data], meta: response[:meta], fetch_next: fetch_page)
  }
  fetch_page.call(page)
end

#reinstate(uuid:, idempotency_key: nil) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reinstate a suspended credential

Returns:

  • (Hash)


206
207
208
# File 'lib/aho_sdk/issuer.rb', line 206

def reinstate(uuid:, idempotency_key: nil)
  @client.post("/v1/issuer/credentials/#{uuid}/reinstate", idempotency_key: idempotency_key)
end

#revoke(uuid:, body: nil, idempotency_key: nil) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Revoke a credential

Returns:

  • (Hash)


192
193
194
# File 'lib/aho_sdk/issuer.rb', line 192

def revoke(uuid:, body: nil, idempotency_key: nil)
  @client.post("/v1/issuer/credentials/#{uuid}/revoke", body: body, idempotency_key: idempotency_key)
end

#status(uuid:) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get credential status

Returns:

  • (Hash)


213
214
215
# File 'lib/aho_sdk/issuer.rb', line 213

def status(uuid:)
  @client.get("/v1/issuer/credentials/#{uuid}/status")
end

#suspend(uuid:, idempotency_key: nil) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Suspend a credential

Returns:

  • (Hash)


199
200
201
# File 'lib/aho_sdk/issuer.rb', line 199

def suspend(uuid:, idempotency_key: nil)
  @client.post("/v1/issuer/credentials/#{uuid}/suspend", idempotency_key: idempotency_key)
end