Class: HubSpotSDK::Resources::Crm::Properties

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

Defined Under Namespace

Classes: Batch, Groups

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Properties

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

Parameters:



224
225
226
227
228
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 224

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

Instance Attribute Details

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



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

def batch
  @batch
end

#groupsHubSpotSDK::Resources::Crm::Properties::Groups (readonly)



11
12
13
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 11

def groups
  @groups
end

Instance Method Details

#create(object_type, field_type:, group_name:, label:, name:, type:, calculation_formula: nil, currency_property_name: nil, data_sensitivity: nil, description: nil, display_order: nil, external_options: nil, form_field: nil, has_unique_value: nil, hidden: nil, options: nil, referenced_object_type: nil, show_currency_symbol: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::Property

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

Create and return a copy of a new property for the specified object type.

Parameters:

  • object_type (String)
  • field_type (Symbol, HubSpotSDK::Models::Crm::PropertyCreate::FieldType)

    Controls how the property appears in HubSpot.

  • group_name (String)

    The name of the property group the property belongs to.

  • label (String)

    A human-readable property label that will be shown in HubSpot.

  • name (String)

    The internal property name, which must be used when referencing the property via

  • type (Symbol, HubSpotSDK::Models::Crm::PropertyCreate::Type)

    The data type of the property.

  • calculation_formula (String)

    Represents a formula that is used to compute a calculated property.

  • currency_property_name (String)
  • data_sensitivity (Symbol, HubSpotSDK::Models::Crm::PropertyCreate::DataSensitivity)

    Indicates the sensitivity level of the property, with options: highly_sensitive,

  • description (String)

    A description of the property that will be shown as help text in HubSpot.

  • display_order (Integer)

    Properties are displayed in order starting with the lowest positive integer valu

  • external_options (Boolean)

    Applicable only for ‘enumeration’ type properties. Should be set to true in con

  • form_field (Boolean)

    Whether or not the property can be used in a HubSpot form.

  • has_unique_value (Boolean)

    Whether or not the property’s value must be unique. Once set, this can’t be chan

  • hidden (Boolean)

    If true, the property won’t be visible and can’t be used in HubSpot.

  • options (Array<HubSpotSDK::Models::OptionInput>)

    A list of valid options for the property. This field is required for enumerated

  • referenced_object_type (String)

    Should be set to ‘OWNER’ when ‘externalOptions’ is true, which causes the proper

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

Returns:

See Also:



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

def create(object_type, params)
  parsed, options = HubSpotSDK::Crm::PropertyCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["crm/properties/2026-03/%1$s", object_type],
    body: parsed,
    model: HubSpotSDK::Crm::Property,
    options: options
  )
end

#delete(property_name, object_type:, request_options: {}) ⇒ nil

Move a property identified by propertyName to the recycling bin.

Parameters:

Returns:

  • (nil)

See Also:



170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 170

def delete(property_name, params)
  parsed, options = HubSpotSDK::Crm::PropertyDeleteParams.dump_request(params)
  object_type =
    parsed.delete(:object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["crm/properties/2026-03/%1$s/%2$s", object_type, property_name],
    model: NilClass,
    options: options
  )
end

#get(property_name, object_type:, archived: nil, data_sensitivity: nil, locale: nil, properties: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::Property

Read a property identified by propertyName.

Parameters:

Returns:

See Also:



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 205

def get(property_name, params)
  parsed, options = HubSpotSDK::Crm::PropertyGetParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  object_type =
    parsed.delete(:object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["crm/properties/2026-03/%1$s/%2$s", object_type, property_name],
    query: query.transform_keys(data_sensitivity: "dataSensitivity"),
    model: HubSpotSDK::Crm::Property,
    options: options
  )
end

#list(object_type, archived: nil, data_sensitivity: nil, locale: nil, properties: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponsePropertyNoPaging

Read all existing properties for the specified object type and HubSpot account.

Parameters:

Returns:

See Also:



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 147

def list(object_type, params = {})
  parsed, options = HubSpotSDK::Crm::PropertyListParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["crm/properties/2026-03/%1$s", object_type],
    query: query.transform_keys(data_sensitivity: "dataSensitivity"),
    model: HubSpotSDK::Crm::CollectionResponsePropertyNoPaging,
    options: options
  )
end

#update(property_name, object_type:, calculation_formula: nil, currency_property_name: nil, description: nil, display_order: nil, field_type: nil, form_field: nil, group_name: nil, hidden: nil, label: nil, options: nil, show_currency_symbol: nil, type: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::Property

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

Perform a partial update of a property identified by { propertyName }. Provided fields will be overwritten.

Parameters:

  • property_name (String)

    Path param

  • object_type (String)

    Path param

  • calculation_formula (String)

    Body param: Represents a formula that is used to compute a calculated property.

  • currency_property_name (String)

    Body param

  • description (String)

    Body param: A description of the property that will be shown as help text in Hub

  • display_order (Integer)

    Body param: Properties are displayed in order starting with the lowest positive

  • field_type (Symbol, HubSpotSDK::Models::Crm::PropertyUpdate::FieldType)

    Body param: Controls how the property appears in HubSpot.

  • form_field (Boolean)

    Body param: Whether or not the property can be used in a HubSpot form.

  • group_name (String)

    Body param: The name of the property group the property belongs to.

  • hidden (Boolean)

    Body param: If true, the property won’t be visible and can’t be used in HubSpot.

  • label (String)

    Body param: A human-readable property label that will be shown in HubSpot.

  • options (Array<HubSpotSDK::Models::OptionInput>)

    Body param: A list of valid options for the property.

  • show_currency_symbol (Boolean)

    Body param

  • type (Symbol, HubSpotSDK::Models::Crm::PropertyUpdate::Type)

    Body param: The data type of the property.

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

Returns:

See Also:



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

def update(property_name, params)
  parsed, options = HubSpotSDK::Crm::PropertyUpdateParams.dump_request(params)
  object_type =
    parsed.delete(:object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["crm/properties/2026-03/%1$s/%2$s", object_type, property_name],
    body: parsed,
    model: HubSpotSDK::Crm::Property,
    options: options
  )
end