Class: Merge::Hris::AvailableActions

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/hris/types/available_actions.rb

Overview

# The AvailableActions Object

### Description
The `Activity` object is used to see all available model/operation combinations
for an integration.
### Usage Example
Fetch all the actions available for the `Zenefits` integration.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(integration:, passthrough_available:, available_model_operations: OMIT, additional_properties: nil) ⇒ Merge::Hris::AvailableActions

Parameters:



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 36

def initialize(integration:, passthrough_available:, available_model_operations: OMIT, additional_properties: nil)
  @integration = integration
  @passthrough_available = passthrough_available
  @available_model_operations = available_model_operations if available_model_operations != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "integration": integration,
    "passthrough_available": passthrough_available,
    "available_model_operations": available_model_operations
  }.reject do |_k, v|
    v == OMIT
  end
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



24
25
26
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 24

def additional_properties
  @additional_properties
end

#available_model_operationsArray<Merge::Hris::ModelOperation> (readonly)

Returns:



22
23
24
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 22

def available_model_operations
  @available_model_operations
end

#integrationMerge::Hris::AccountIntegration (readonly)



18
19
20
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 18

def integration
  @integration
end

#passthrough_availableBoolean (readonly)

Returns:

  • (Boolean)


20
21
22
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 20

def passthrough_available
  @passthrough_available
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Hris::AvailableActions

Deserialize a JSON object to an instance of AvailableActions

Parameters:

  • json_object (String)

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["integration"].nil?
    integration = nil
  else
    integration = parsed_json["integration"].to_json
    integration = Merge::Hris::AccountIntegration.from_json(json_object: integration)
  end
  passthrough_available = parsed_json["passthrough_available"]
  available_model_operations = parsed_json["available_model_operations"]&.map do |item|
    item = item.to_json
    Merge::Hris::ModelOperation.from_json(json_object: item)
  end
  new(
    integration: integration,
    passthrough_available: passthrough_available,
    available_model_operations: available_model_operations,
    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)


89
90
91
92
93
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 89

def self.validate_raw(obj:)
  Merge::Hris::AccountIntegration.validate_raw(obj: obj.integration)
  obj.passthrough_available.is_a?(Boolean) != false || raise("Passed value for field obj.passthrough_available is not the expected type, validation failed.")
  obj.available_model_operations&.is_a?(Array) != false || raise("Passed value for field obj.available_model_operations is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AvailableActions to a JSON object

Returns:

  • (String)


79
80
81
# File 'lib/merge_ruby_client/hris/types/available_actions.rb', line 79

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