Class: HubSpotSDK::Resources::Automation::Actions::Functions

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/automation/actions/functions.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Functions

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

Parameters:



281
282
283
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 281

def initialize(client:)
  @client = client
end

Instance Method Details

#create_or_replace(function_id, app_id:, definition_id:, function_type:, body:, request_options: {}) ⇒ HubSpotSDK::Models::Automation::PublicActionFunctionIdentifier

Update a function for a given definition by ID.

Parameters:

Returns:

See Also:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 93

def create_or_replace(function_id, params)
  parsed, options = HubSpotSDK::Automation::Actions::FunctionCreateOrReplaceParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  definition_id =
    parsed.delete(:definition_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  function_type =
    parsed.delete(:function_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: [
      "automation/actions/2026-03/%1$s/%2$s/functions/%3$s/%4$s",
      app_id,
      definition_id,
      function_type,
      function_id
    ],
    headers: {"content-type" => "text/plain"},
    body: parsed[:body],
    model: HubSpotSDK::Automation::PublicActionFunctionIdentifier,
    options: options
  )
end

#create_or_replace_by_function_type(function_type, app_id:, definition_id:, body:, request_options: {}) ⇒ HubSpotSDK::Models::Automation::PublicActionFunctionIdentifier

Add a function for a given definition.

Parameters:

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 140

def create_or_replace_by_function_type(function_type, params)
  parsed, options =
    HubSpotSDK::Automation::Actions::FunctionCreateOrReplaceByFunctionTypeParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  definition_id =
    parsed.delete(:definition_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: [
      "automation/actions/2026-03/%1$s/%2$s/functions/%3$s",
      app_id,
      definition_id,
      function_type
    ],
    headers: {"content-type" => "text/plain"},
    body: parsed[:body],
    model: HubSpotSDK::Automation::PublicActionFunctionIdentifier,
    options: options
  )
end

#delete(function_id, app_id:, definition_id:, function_type:, request_options: {}) ⇒ nil

Archive a function for a specific definition.

Parameters:

Returns:

  • (nil)

See Also:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 46

def delete(function_id, params)
  parsed, options = HubSpotSDK::Automation::Actions::FunctionDeleteParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  definition_id =
    parsed.delete(:definition_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  function_type =
    parsed.delete(:function_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: [
      "automation/actions/2026-03/%1$s/%2$s/functions/%3$s/%4$s",
      app_id,
      definition_id,
      function_type,
      function_id
    ],
    model: NilClass,
    options: options
  )
end

#delete_by_function_type(function_type, app_id:, definition_id:, request_options: {}) ⇒ nil

Delete a function within a given definition.

Parameters:

Returns:

  • (nil)

See Also:



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 178

def delete_by_function_type(function_type, params)
  parsed, options =
    HubSpotSDK::Automation::Actions::FunctionDeleteByFunctionTypeParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  definition_id =
    parsed.delete(:definition_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: [
      "automation/actions/2026-03/%1$s/%2$s/functions/%3$s",
      app_id,
      definition_id,
      function_type
    ],
    model: NilClass,
    options: options
  )
end

#get(function_id, app_id:, definition_id:, function_type:, request_options: {}) ⇒ HubSpotSDK::Models::Automation::PublicActionFunction

Retrieve a specific function from a given definition.

Parameters:

Returns:

See Also:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 215

def get(function_id, params)
  parsed, options = HubSpotSDK::Automation::Actions::FunctionGetParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  definition_id =
    parsed.delete(:definition_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  function_type =
    parsed.delete(:function_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: [
      "automation/actions/2026-03/%1$s/%2$s/functions/%3$s/%4$s",
      app_id,
      definition_id,
      function_type,
      function_id
    ],
    model: HubSpotSDK::Automation::PublicActionFunction,
    options: options
  )
end

#get_by_function_type(function_type, app_id:, definition_id:, request_options: {}) ⇒ HubSpotSDK::Models::Automation::PublicActionFunction

Retrieve functions of a specific type for a given definition.



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 255

def get_by_function_type(function_type, params)
  parsed, options = HubSpotSDK::Automation::Actions::FunctionGetByFunctionTypeParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  definition_id =
    parsed.delete(:definition_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: [
      "automation/actions/2026-03/%1$s/%2$s/functions/%3$s",
      app_id,
      definition_id,
      function_type
    ],
    model: HubSpotSDK::Automation::PublicActionFunction,
    options: options
  )
end

#list(definition_id, app_id:, request_options: {}) ⇒ HubSpotSDK::Models::Automation::CollectionResponsePublicActionFunctionIdentifierNoPaging

Retrieve all functions included in a definition.

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hubspot_sdk/resources/automation/actions/functions.rb', line 19

def list(definition_id, params)
  parsed, options = HubSpotSDK::Automation::Actions::FunctionListParams.dump_request(params)
  app_id =
    parsed.delete(:app_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["automation/actions/2026-03/%1$s/%2$s/functions", app_id, definition_id],
    model: HubSpotSDK::Automation::CollectionResponsePublicActionFunctionIdentifierNoPaging,
    options: options
  )
end