Class: Stigg::Resources::V1Beta::Entities
- Inherits:
-
Object
- Object
- Stigg::Resources::V1Beta::Entities
- Defined in:
- lib/stigg/resources/v1_beta/entities.rb
Instance Method Summary collapse
-
#archive(id, ids:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityArchiveResponse
Archives entities in bulk for the given customer by id.
-
#initialize(client:) ⇒ Entities
constructor
private
A new instance of Entities.
-
#list(id, after: nil, before: nil, include_archived: nil, limit: nil, type_ref_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1Beta::EntityListResponse>
Retrieves a paginated list of entities for the given customer.
-
#retrieve(entity_id, id:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityRetrieveResponse
Retrieves a single entity for the given customer by its identifier.
-
#unarchive(id, ids:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityUnarchiveResponse
Restores previously archived entities in bulk for the given customer by id.
-
#upsert(id, entities:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityUpsertResponse
Creates or updates entities in bulk for the given customer.
Constructor Details
#initialize(client:) ⇒ Entities
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 Entities.
144 145 146 |
# File 'lib/stigg/resources/v1_beta/entities.rb', line 144 def initialize(client:) @client = client end |
Instance Method Details
#archive(id, ids:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityArchiveResponse
Archives entities in bulk for the given customer by id.
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/stigg/resources/v1_beta/entities.rb', line 81 def archive(id, params) parsed, = Stigg::V1Beta::EntityArchiveParams.dump_request(params) @client.request( method: :post, path: ["api/v1-beta/customers/%1$s/entities/archive", id], body: parsed, model: Stigg::Models::V1Beta::EntityArchiveResponse, options: ) end |
#list(id, after: nil, before: nil, include_archived: nil, limit: nil, type_ref_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1Beta::EntityListResponse>
Retrieves a paginated list of entities for the given customer.
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/stigg/resources/v1_beta/entities.rb', line 55 def list(id, params = {}) parsed, = Stigg::V1Beta::EntityListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v1-beta/customers/%1$s/entities", id], query: query.transform_keys(include_archived: "includeArchived", type_ref_id: "typeRefId"), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1Beta::EntityListResponse, options: ) end |
#retrieve(entity_id, id:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityRetrieveResponse
Retrieves a single entity for the given customer by its identifier.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stigg/resources/v1_beta/entities.rb', line 20 def retrieve(entity_id, params) parsed, = Stigg::V1Beta::EntityRetrieveParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["api/v1-beta/customers/%1$s/entities/%2$s", id, entity_id], model: Stigg::Models::V1Beta::EntityRetrieveResponse, options: ) end |
#unarchive(id, ids:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityUnarchiveResponse
Restores previously archived entities in bulk for the given customer by id.
105 106 107 108 109 110 111 112 113 114 |
# File 'lib/stigg/resources/v1_beta/entities.rb', line 105 def unarchive(id, params) parsed, = Stigg::V1Beta::EntityUnarchiveParams.dump_request(params) @client.request( method: :post, path: ["api/v1-beta/customers/%1$s/entities/unarchive", id], body: parsed, model: Stigg::Models::V1Beta::EntityUnarchiveResponse, options: ) end |
#upsert(id, entities:, request_options: {}) ⇒ Stigg::Models::V1Beta::EntityUpsertResponse
Creates or updates entities in bulk for the given customer. Existing entities matched by id are updated; new ids are created.
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/stigg/resources/v1_beta/entities.rb', line 130 def upsert(id, params) parsed, = Stigg::V1Beta::EntityUpsertParams.dump_request(params) @client.request( method: :put, path: ["api/v1-beta/customers/%1$s/entities", id], body: parsed, model: Stigg::Models::V1Beta::EntityUpsertResponse, options: ) end |