Class: VoiceTel::Resources::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/voicetel/resources/account.rb

Overview

AccountService — Account tag in the OpenAPI spec.

Rate-limited endpoints (6 req/hour/IP, shared with Client#login): ‘cdr`, `recurring_charges`, `payments`, `registration`, and `info`.

Instance Method Summary collapse

Methods inherited from Base

#compact_query, #initialize

Constructor Details

This class inherits a constructor from VoiceTel::Resources::Base

Instance Method Details

#add(body) ⇒ Object

POST /v2.2/account — create a sub-account (admin-only).



23
24
25
# File 'lib/voicetel/resources/account.rb', line 23

def add(body)
  @transport.request(:post, "/v2.2/account", body: body)
end

#cdr(start: nil, end_at: nil) ⇒ Object

GET /v2.2/account/cdr — call detail records. Rate-limited.



33
34
35
36
# File 'lib/voicetel/resources/account.rb', line 33

def cdr(start: nil, end_at: nil)
  q = compact_query("start" => start, "end" => end_at)
  @transport.request(:get, "/v2.2/account/cdr", query: q)
end

#creditsObject

GET /v2.2/account/credits — credit history.



39
40
41
# File 'lib/voicetel/resources/account.rb', line 39

def credits
  @transport.request(:get, "/v2.2/account/credits")
end

#getObject

GET /v2.2/account — return the authenticated account profile.



13
14
15
# File 'lib/voicetel/resources/account.rb', line 13

def get
  @transport.request(:get, "/v2.2/account")
end

#paymentsObject

GET /v2.2/account/payments — payment history. Rate-limited.



49
50
51
# File 'lib/voicetel/resources/account.rb', line 49

def payments
  @transport.request(:get, "/v2.2/account/payments")
end

#recover(body) ⇒ Object

POST /v2.2/account/recovery — start password recovery. No auth required.



59
60
61
# File 'lib/voicetel/resources/account.rb', line 59

def recover(body)
  @transport.request(:post, "/v2.2/account/recovery", body: body, require_auth: false)
end

#recurring_chargesObject

GET /v2.2/account/recurring-charges — active monthly recurring charges. Rate-limited.



44
45
46
# File 'lib/voicetel/resources/account.rb', line 44

def recurring_charges
  @transport.request(:get, "/v2.2/account/recurring-charges")
end

#registrationObject

GET /v2.2/account/registration — current SIP registration. Rate-limited.



54
55
56
# File 'lib/voicetel/resources/account.rb', line 54

def registration
  @transport.request(:get, "/v2.2/account/registration")
end

#signup(body) ⇒ Object

POST /v2.2/accounts — public sign-up flow.



28
29
30
# File 'lib/voicetel/resources/account.rb', line 28

def (body)
  @transport.request(:post, "/v2.2/accounts", body: body)
end

#update(body) ⇒ Object

PUT /v2.2/account — partial-update account settings.



18
19
20
# File 'lib/voicetel/resources/account.rb', line 18

def update(body)
  @transport.request(:put, "/v2.2/account", body: body)
end