Class: Courier::Automations::AutomationUpdateProfileStep

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/automations/types/automation_update_profile_step.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, recipient_id:, profile:, merge:, additional_properties: nil) ⇒ Automations::AutomationUpdateProfileStep

Parameters:



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 18

def initialize(action:, recipient_id:, profile:, merge:, additional_properties: nil)
  # @type [String]
  @action = action
  # @type [String]
  @recipient_id = recipient_id
  # @type [Automations::PROFILE]
  @profile = profile
  # @type [Automations::MergeAlgorithm]
  @merge = merge
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



10
11
12
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 10

def action
  @action
end

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



10
11
12
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 10

def additional_properties
  @additional_properties
end

#mergeObject (readonly)

Returns the value of attribute merge.



10
11
12
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 10

def merge
  @merge
end

#profileObject (readonly)

Returns the value of attribute profile.



10
11
12
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 10

def profile
  @profile
end

#recipient_idObject (readonly)

Returns the value of attribute recipient_id.



10
11
12
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 10

def recipient_id
  @recipient_id
end

Class Method Details

.from_json(json_object:) ⇒ Automations::AutomationUpdateProfileStep

Deserialize a JSON object to an instance of AutomationUpdateProfileStep

Parameters:

  • json_object (JSON)

Returns:



35
36
37
38
39
40
41
42
43
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 35

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  JSON.parse(json_object)
  action = struct.action
  recipient_id = struct.recipient_id
  profile = struct.profile
  merge = struct.merge
  new(action: action, recipient_id: recipient_id, profile: profile, merge: merge, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


56
57
58
59
60
61
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 56

def self.validate_raw(obj:)
  obj.action.is_a?(String) != false || raise("Passed value for field obj.action is not the expected type, validation failed.")
  obj.recipient_id.is_a?(String) != false || raise("Passed value for field obj.recipient_id is not the expected type, validation failed.")
  obj.profile.is_a?(Object) != false || raise("Passed value for field obj.profile is not the expected type, validation failed.")
  obj.merge.is_a?(Automations::MergeAlgorithm) != false || raise("Passed value for field obj.merge is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of AutomationUpdateProfileStep to a JSON object

Returns:

  • (JSON)


48
49
50
# File 'lib/trycourier/automations/types/automation_update_profile_step.rb', line 48

def to_json(*_args)
  { "action": @action, "recipient_id": @recipient_id, "profile": @profile, "merge": @merge }.to_json
end