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:



206
207
208
209
210
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 206

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, number_display_hint: nil, options: nil, referenced_object_type: nil, show_currency_symbol: nil, request_options: {}) ⇒ HubSpotSDK::Models::Property

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

Parameters:

Returns:

See Also:



41
42
43
44
45
46
47
48
49
50
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 41

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::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:



152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 152

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::Property

Read a property identified by propertyName.

Parameters:

Returns:

See Also:



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 187

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::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:



129
130
131
132
133
134
135
136
137
138
139
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 129

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, number_display_hint: nil, options: nil, show_currency_symbol: nil, type: nil, request_options: {}) ⇒ HubSpotSDK::Models::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.

  • number_display_hint (Symbol, HubSpotSDK::Models::Crm::PropertyUpdate::NumberDisplayHint)

    Body param

  • 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:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/hubspot_sdk/resources/crm/properties.rb', line 95

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::Property,
    options: options
  )
end