Class: Melaya::AccountsAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/melaya/accounts.rb

Overview

Accounts API — GDPR data export, API key management, and profile updates.

Maps to /api/v1/private/accounts/* and /api/v1/private/keys/*.

Note: credit balance endpoints live in BillingAPI to keep billing concerns co-located. Key listing is in AccountAPI (trading plane) for backward compatibility; this module covers the write/management side.

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ AccountsAPI

Returns a new instance of AccountsAPI.



12
13
14
# File 'lib/melaya/accounts.rb', line 12

def initialize(http)
  @http = http
end

Instance Method Details

#export_dataObject

POST /api/v1/private/accounts/export GDPR Art 15/20 data export; returns JSON blob of all user data.



18
19
20
# File 'lib/melaya/accounts.rb', line 18

def export_data
  @http.post("/api/v1/private/accounts/export")
end

#remove_key(key_id) ⇒ Object

DELETE /api/v1/private/keys/:keyId Remove a stored CEX API key.

Parameters:

  • key_id (String)


25
26
27
# File 'lib/melaya/accounts.rb', line 25

def remove_key(key_id)
  @http.delete("/api/v1/private/keys/#{enc(key_id)}")
end

#update_profile(body = {}) ⇒ Object

PATCH /api/v1/private/accounts/profile Update user display name, avatar, or settings.

Parameters:

  • body (Hash) (defaults to: {})


32
33
34
# File 'lib/melaya/accounts.rb', line 32

def update_profile(body = {})
  @http.patch("/api/v1/private/accounts/profile", body)
end