Class: HubSpotSDK::Resources::Crm::FeatureFlags

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/crm/feature_flags.rb,
lib/hubspot_sdk/resources/crm/feature_flags/batch.rb

Defined Under Namespace

Classes: Batch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ FeatureFlags

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

Parameters:



249
250
251
252
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 249

def initialize(client:)
  @client = client
  @batch = HubSpotSDK::Resources::Crm::FeatureFlags::Batch.new(client: client)
end

Instance Attribute Details

#batchHubSpotSDK::Resources::Crm::FeatureFlags::Batch (readonly)



8
9
10
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 8

def batch
  @batch
end

Instance Method Details

#delete(flag_name, app_id:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::FlagResponse

Delete a feature flag in an app. For example, delete the ‘hs-release-app-cards` flag after all accounts have been migrated.

Parameters:

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 58

def delete(flag_name, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagDeleteParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s", app_id, flag_name],
    model: HubSpotSDK::Crm::FlagResponse,
    options: options
  )
end

#delete_portal_state(portal_id, app_id:, flag_name:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::PortalFlagStateResponse

Delete an account-level flag state for a specific HubSpot account. No request body is included.

Parameters:

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 85

def delete_portal_state(portal_id, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagDeletePortalStateParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  flag_name =
    parsed.delete(:flag_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s/portals/%3$s", app_id, flag_name, portal_id],
    model: HubSpotSDK::Crm::PortalFlagStateResponse,
    options: options
  )
end

#get(flag_name, app_id:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::FlagResponse

Retrieve the current status of the app’s feature flags. No request body is included.

Parameters:

Returns:

See Also:



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 115

def get(flag_name, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagGetParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s", app_id, flag_name],
    model: HubSpotSDK::Crm::FlagResponse,
    options: options
  )
end

#get_portal_state(portal_id, app_id:, flag_name:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::PortalFlagStateResponse

Retrieve the account-level flag state of a specific HubSpot account.

Parameters:

Returns:

See Also:



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 141

def get_portal_state(portal_id, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagGetPortalStateParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  flag_name =
    parsed.delete(:flag_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s/portals/%3$s", app_id, flag_name, portal_id],
    model: HubSpotSDK::Crm::PortalFlagStateResponse,
    options: options
  )
end

#list_all(app_id, request_options: {}) ⇒ HubSpotSDK::Models::Crm::FlagsForAppResponse

Parameters:

Returns:

See Also:



167
168
169
170
171
172
173
174
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 167

def list_all(app_id, params = {})
  @client.request(
    method: :get,
    path: ["feature-flags/2026-03/%1$s/flags/all", app_id],
    model: HubSpotSDK::Crm::FlagsForAppResponse,
    options: params[:request_options]
  )
end

#list_portals(flag_name, app_id:, limit: nil, start_portal_id: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::PortalFlagStateBatchResponse

Retrieve a list of HubSpot accounts with an account-level flag setting for the specified app. No request body is included.

Parameters:

  • flag_name (String)

    Path param

  • app_id (Integer)

    Path param

  • limit (Integer)

    Query param: The maximum number of results to display per page.

  • start_portal_id (Integer)

    Query param

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

Returns:

See Also:



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 194

def list_portals(flag_name, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagListPortalsParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s/portals", app_id, flag_name],
    query: query.transform_keys(start_portal_id: "startPortalId"),
    model: HubSpotSDK::Crm::PortalFlagStateBatchResponse,
    options: options
  )
end

#update(flag_name, app_id:, default_state:, override_state: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::FlagResponse

Some parameter documentations has been truncated, see Models::Crm::FeatureFlagUpdateParams for more details.

Set a feature flag for an app. For example, update the ‘hs-hide-crm-cards` flag’s ‘defaultState` to `ON` to hide classic CRM cards from new installs.

Parameters:

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 31

def update(flag_name, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagUpdateParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s", app_id, flag_name],
    body: parsed,
    model: HubSpotSDK::Crm::FlagResponse,
    options: options
  )
end

#update_portal_state(portal_id, app_id:, flag_name:, flag_state:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::PortalFlagStateResponse

Specify an account-level flag state for a specific HubSpot account.

Parameters:

Returns:

See Also:



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/hubspot_sdk/resources/crm/feature_flags.rb', line 227

def update_portal_state(portal_id, params)
  parsed, options = HubSpotSDK::Crm::FeatureFlagUpdatePortalStateParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  flag_name =
    parsed.delete(:flag_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["feature-flags/2026-03/%1$s/flags/%2$s/portals/%3$s", app_id, flag_name, portal_id],
    body: parsed,
    model: HubSpotSDK::Crm::PortalFlagStateResponse,
    options: options
  )
end