Class: Seatsio::SubaccountsClient
- Inherits:
-
Object
- Object
- Seatsio::SubaccountsClient
- Defined in:
- lib/seatsio/subaccounts.rb
Instance Method Summary collapse
- #activate(id:) ⇒ Object
- #active ⇒ Object
- #copy_chart_to_parent(id: nil, chart_key: nil) ⇒ Object
- #copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil) ⇒ Object
- #create(name: nil) ⇒ Object
- #deactivate(id:) ⇒ Object
- #inactive ⇒ Object
-
#initialize(secret_key, workspace_key, base_url) ⇒ SubaccountsClient
constructor
A new instance of SubaccountsClient.
- #list(filter: nil) ⇒ Object
- #regenerate_designer_key(id:) ⇒ Object
- #regenerate_secret_key(id:) ⇒ Object
- #retrieve(id:) ⇒ Object
- #update(id:, name: nil) ⇒ Object
Constructor Details
#initialize(secret_key, workspace_key, base_url) ⇒ SubaccountsClient
Returns a new instance of SubaccountsClient.
11 12 13 |
# File 'lib/seatsio/subaccounts.rb', line 11 def initialize(secret_key, workspace_key, base_url) @http_client = ::Seatsio::HttpClient.new(secret_key, workspace_key, base_url) end |
Instance Method Details
#activate(id:) ⇒ Object
43 44 45 |
# File 'lib/seatsio/subaccounts.rb', line 43 def activate(id:) @http_client.post("/subaccounts/#{id}/actions/activate") end |
#active ⇒ Object
35 36 37 |
# File 'lib/seatsio/subaccounts.rb', line 35 def active cursor status: 'active' end |
#copy_chart_to_parent(id: nil, chart_key: nil) ⇒ Object
56 57 58 59 |
# File 'lib/seatsio/subaccounts.rb', line 56 def copy_chart_to_parent(id: nil, chart_key: nil) response = @http_client.post("/subaccounts/#{id}/charts/#{chart_key}/actions/copy-to/parent") Domain::Chart.new(response) end |
#copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil) ⇒ Object
61 62 63 64 |
# File 'lib/seatsio/subaccounts.rb', line 61 def copy_chart_to_subaccount(from_id: nil, to_id: nil, chart_key: nil) response = @http_client.post("/subaccounts/#{from_id}/charts/#{chart_key}/actions/copy-to/#{to_id}") Domain::Chart.new(response) end |
#create(name: nil) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/seatsio/subaccounts.rb', line 15 def create(name: nil) body = {} body['name'] = name if name response = @http_client.post("subaccounts", body) Domain::Subaccount.new(response) end |
#deactivate(id:) ⇒ Object
47 48 49 |
# File 'lib/seatsio/subaccounts.rb', line 47 def deactivate(id:) @http_client.post("/subaccounts/#{id}/actions/deactivate") end |
#inactive ⇒ Object
39 40 41 |
# File 'lib/seatsio/subaccounts.rb', line 39 def inactive cursor status: 'inactive' end |
#list(filter: nil) ⇒ Object
29 30 31 32 33 |
# File 'lib/seatsio/subaccounts.rb', line 29 def list(filter: nil) extended_cursor = cursor extended_cursor.set_query_param('filter', filter) extended_cursor end |
#regenerate_designer_key(id:) ⇒ Object
70 71 72 |
# File 'lib/seatsio/subaccounts.rb', line 70 def regenerate_designer_key(id:) @http_client.post("/subaccounts/#{id}/designer-key/actions/regenerate") end |
#regenerate_secret_key(id:) ⇒ Object
66 67 68 |
# File 'lib/seatsio/subaccounts.rb', line 66 def regenerate_secret_key(id:) @http_client.post("/subaccounts/#{id}/secret-key/actions/regenerate") end |
#retrieve(id:) ⇒ Object
51 52 53 54 |
# File 'lib/seatsio/subaccounts.rb', line 51 def retrieve(id:) response = @http_client.get("/subaccounts/#{id}") Domain::Subaccount.new(response) end |
#update(id:, name: nil) ⇒ Object
23 24 25 26 27 |
# File 'lib/seatsio/subaccounts.rb', line 23 def update(id:, name: nil) body = {} body['name'] = name if name @http_client.post("subaccounts/#{id}", body) end |