Class: CandidApiClient::Tasks::V3::Types::TaskAction

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/tasks/v_3/types/task_action.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display_name:, execution_method:, type:, additional_properties: nil) ⇒ CandidApiClient::Tasks::V3::Types::TaskAction

Parameters:



32
33
34
35
36
37
38
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 32

def initialize(display_name:, execution_method:, type:, additional_properties: nil)
  @display_name = display_name
  @execution_method = execution_method
  @type = type
  @additional_properties = additional_properties
  @_field_set = { "display_name": display_name, "execution_method": execution_method, "type": type }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 20

def additional_properties
  @additional_properties
end

#display_nameString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 14

def display_name
  @display_name
end

#execution_methodCandidApiClient::Tasks::V3::Types::TaskActionExecutionMethod (readonly)



16
17
18
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 16

def execution_method
  @execution_method
end

#typeCandidApiClient::Tasks::V3::Types::TaskActionType (readonly)



18
19
20
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 18

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Tasks::V3::Types::TaskAction

Deserialize a JSON object to an instance of TaskAction

Parameters:

  • json_object (String)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 44

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  display_name = struct["display_name"]
  if parsed_json["execution_method"].nil?
    execution_method = nil
  else
    execution_method = parsed_json["execution_method"].to_json
    execution_method = CandidApiClient::Tasks::V3::Types::TaskActionExecutionMethod.from_json(json_object: execution_method)
  end
  type = struct["type"]
  new(
    display_name: display_name,
    execution_method: execution_method,
    type: type,
    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)


76
77
78
79
80
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 76

def self.validate_raw(obj:)
  obj.display_name.is_a?(String) != false || raise("Passed value for field obj.display_name is not the expected type, validation failed.")
  CandidApiClient::Tasks::V3::Types::TaskActionExecutionMethod.validate_raw(obj: obj.execution_method)
  obj.type.is_a?(CandidApiClient::Tasks::V3::Types::TaskActionType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of TaskAction to a JSON object

Returns:

  • (String)


66
67
68
# File 'lib/candidhealth/tasks/v_3/types/task_action.rb', line 66

def to_json(*_args)
  @_field_set&.to_json
end