Class: Stigg::Resources::V1::Customers::Integrations

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/customers/integrations.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Integrations

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 Integrations.

Parameters:



161
162
163
# File 'lib/stigg/resources/v1/customers/integrations.rb', line 161

def initialize(client:)
  @client = client
end

Instance Method Details

Links a customer to an external integration by specifying the vendor and external entity ID.

Parameters:

Returns:

See Also:



120
121
122
123
124
125
126
127
128
129
# File 'lib/stigg/resources/v1/customers/integrations.rb', line 120

def link(path_id, params)
  parsed, options = Stigg::V1::Customers::IntegrationLinkParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/v1/customers/%1$s/integrations", path_id],
    body: parsed,
    model: Stigg::V1::CustomerIntegrationResponse,
    options: options
  )
end

#list(id, after: nil, before: nil, limit: nil, vendor_identifier: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Customers::IntegrationListResponse>

Some parameter documentations has been truncated, see Models::V1::Customers::IntegrationListParams for more details.

Retrieves a paginated list of a customer’s external integrations (billing, CRM, etc.).

Parameters:

  • id (String)

    The unique identifier of the entity

  • after (String)

    Return items that come after this cursor

  • before (String)

    Return items that come before this cursor

  • limit (Integer)

    Maximum number of items to return

  • vendor_identifier (String)

    Filter by vendor identifier. Supports comma-separated values for multiple vendor

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/stigg/resources/v1/customers/integrations.rb', line 89

def list(id, params = {})
  parsed, options = Stigg::V1::Customers::IntegrationListParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["api/v1/customers/%1$s/integrations", id],
    query: query.transform_keys(vendor_identifier: "vendorIdentifier"),
    page: Stigg::Internal::MyCursorIDPage,
    model: Stigg::Models::V1::Customers::IntegrationListResponse,
    options: options
  )
end

#retrieve(integration_id, id:, request_options: {}) ⇒ Stigg::Models::V1::CustomerIntegrationResponse

Retrieves a specific integration for a customer by integration ID.

Parameters:

  • integration_id (String)

    Integration details

  • id (String)

    Customer slug

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/stigg/resources/v1/customers/integrations.rb', line 21

def retrieve(integration_id, params)
  parsed, options = Stigg::V1::Customers::IntegrationRetrieveParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["api/v1/customers/%1$s/integrations/%2$s", id, integration_id],
    model: Stigg::V1::CustomerIntegrationResponse,
    options: options
  )
end

Removes the link between a customer and an external integration.

Parameters:

  • integration_id (String)

    Integration details

  • id (String)

    Customer slug

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/stigg/resources/v1/customers/integrations.rb', line 144

def unlink(integration_id, params)
  parsed, options = Stigg::V1::Customers::IntegrationUnlinkParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["api/v1/customers/%1$s/integrations/%2$s", id, integration_id],
    model: Stigg::V1::CustomerIntegrationResponse,
    options: options
  )
end

#update(integration_id, id:, synced_entity_id:, request_options: {}) ⇒ Stigg::Models::V1::CustomerIntegrationResponse

Updates a customer’s integration link, such as changing the synced external entity ID.

Parameters:

  • integration_id (String)

    Path param: Integration details

  • id (String)

    Path param: Customer slug

  • synced_entity_id (String, nil)

    Body param: Synced entity id

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/stigg/resources/v1/customers/integrations.rb', line 51

def update(integration_id, params)
  parsed, options = Stigg::V1::Customers::IntegrationUpdateParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["api/v1/customers/%1$s/integrations/%2$s", id, integration_id],
    body: parsed,
    model: Stigg::V1::CustomerIntegrationResponse,
    options: options
  )
end