Class: Infrawrench::CostCentresNamespace
- Inherits:
-
Object
- Object
- Infrawrench::CostCentresNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.cost_centres
Instance Attribute Summary collapse
-
#rules ⇒ CostCentresRulesNamespace
readonly
client.cost_centres.rules.
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a cost centre.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a cost centre (its allocation rules go with it).
-
#initialize(transport) ⇒ CostCentresNamespace
constructor
private
A new instance of CostCentresNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List cost centres.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a cost centre.
Constructor Details
#initialize(transport) ⇒ CostCentresNamespace
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 CostCentresNamespace.
1778 1779 1780 1781 |
# File 'lib/infrawrench/client.rb', line 1778 def initialize(transport) @transport = transport @rules = CostCentresRulesNamespace.new(@transport) end |
Instance Attribute Details
#rules ⇒ CostCentresRulesNamespace (readonly)
Returns client.cost_centres.rules.
1774 1775 1776 |
# File 'lib/infrawrench/client.rb', line 1774 def rules @rules end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a cost centre
Requires permission: costs:write.
POST /api/org/orgId/cost-centres
Raises on 400: Bad request
1797 1798 1799 1800 1801 1802 1803 1804 1805 |
# File 'lib/infrawrench/client.rb', line 1797 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/cost-centres", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a cost centre (its allocation rules go with it)
Requires permission: costs:write.
DELETE /api/org/orgId/cost-centres/id
Raises on 404: Not found
1821 1822 1823 1824 1825 1826 1827 1828 |
# File 'lib/infrawrench/client.rb', line 1821 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/cost-centres/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List cost centres
Requires permission: costs:read.
GET /api/org/orgId/cost-centres
1842 1843 1844 1845 1846 1847 1848 1849 |
# File 'lib/infrawrench/client.rb', line 1842 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/cost-centres", path_params: { "orgId" => org_id }, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a cost centre
Requires permission: costs:write.
PUT /api/org/orgId/cost-centres/id
Raises on 400: Bad request
Raises on 404: Not found
1868 1869 1870 1871 1872 1873 1874 1875 1876 |
# File 'lib/infrawrench/client.rb', line 1868 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/cost-centres/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |