Class: Infrawrench::ManagedAccountsNamespace
- Inherits:
-
Object
- Object
- Infrawrench::ManagedAccountsNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.managed_accounts
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a managed account.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Retire a managed account.
-
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a managed account.
-
#initialize(transport) ⇒ ManagedAccountsNamespace
constructor
private
A new instance of ManagedAccountsNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List managed accounts.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a managed account.
Constructor Details
#initialize(transport) ⇒ ManagedAccountsNamespace
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 ManagedAccountsNamespace.
9281 9282 9283 |
# File 'lib/infrawrench/client.rb', line 9281 def initialize(transport) @transport = transport end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a managed account
Refused with 409 when a cost centre or account named here is already billed to another customer. The error names the other customer, because “it conflicts” without saying with whom sends the caller hunting.
Requires permission: invoices:write.
POST /api/org/orgId/managed-accounts
Raises on 400: Bad request
Raises on 409: Conflict
9305 9306 9307 9308 9309 9310 9311 9312 9313 |
# File 'lib/infrawrench/client.rb', line 9305 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/managed-accounts", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Retire a managed account
A soft delete: an issued invoice names its customer, and an invoice whose customer stopped resolving is exactly the unreconcilable document this feature exists to prevent. Draft invoices are removed with it — a draft was never issued.
Requires permission: invoices:write.
DELETE /api/org/orgId/managed-accounts/id
Raises on 404: Not found
9334 9335 9336 9337 9338 9339 9340 9341 |
# File 'lib/infrawrench/client.rb', line 9334 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/managed-accounts/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a managed account
Requires permission: invoices:read.
GET /api/org/orgId/managed-accounts/id
Raises on 404: Not found
9357 9358 9359 9360 9361 9362 9363 9364 |
# File 'lib/infrawrench/client.rb', line 9357 def get(id:, org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/managed-accounts/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List managed accounts
The customers a managed service provider bills. A managed account references existing cost centres rather than defining its own matching rules, so the spend on an invoice is the same spend the showback report attributes to those centres.
Requires permission: invoices:read.
GET /api/org/orgId/managed-accounts
9383 9384 9385 9386 9387 9388 9389 9390 |
# File 'lib/infrawrench/client.rb', line 9383 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/managed-accounts", path_params: { "orgId" => org_id }, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a managed account
A full replace. Editing the scope changes what future drafts are drawn over and nothing else: every approved invoice holds its own copy of the scope, so moving a cost centre between customers cannot re-bill a period that has already been invoiced.
Requires permission: invoices:write.
PUT /api/org/orgId/managed-accounts/id
Raises on 400: Bad request
Raises on 404: Not found
Raises on 409: Conflict
9416 9417 9418 9419 9420 9421 9422 9423 9424 |
# File 'lib/infrawrench/client.rb', line 9416 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/managed-accounts/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |