Class: Gusto::EmployeePaymentMethod::EmployeePaymentMethodInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version: OMIT, type: OMIT, split_by: OMIT, splits: OMIT, additional_properties: nil) ⇒ Gusto::EmployeePaymentMethod::EmployeePaymentMethodInfo

Parameters:

  • splits (Array<Gusto::PaymentMethodBankAccount>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



44
45
46
47
48
49
50
51
52
53
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 44

def initialize(version: OMIT, type: OMIT, split_by: OMIT, splits: OMIT, additional_properties: nil)
  @version = version if version != OMIT
  @type = type if type != OMIT
  @split_by = split_by if split_by != OMIT
  @splits = splits if splits != OMIT
  @additional_properties = additional_properties
  @_field_set = { "version": version, "type": type, "split_by": split_by, "splits": splits }.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



26
27
28
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 26

def additional_properties
  @additional_properties
end

#split_byObject (readonly)

split amount must be nil to capture the remainder.



22
23
24
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 22

def split_by
  @split_by
end

#splitsArray<Gusto::PaymentMethodBankAccount> (readonly)



24
25
26
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 24

def splits
  @splits
end

#typeObject (readonly)

to be populated. If type is Direct Deposit, split_by and splits are required.



18
19
20
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 18

def type
  @type
end

#versionObject (readonly)

on how to use this field.



15
16
17
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 15

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::EmployeePaymentMethod::EmployeePaymentMethodInfo

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  version = parsed_json["version"]
  type = parsed_json["type"]
  split_by = parsed_json["split_by"]
  splits = parsed_json["splits"]&.map do | item |
  item = item.to_json
  Gusto::PaymentMethodBankAccount.from_json(json_object: item)
end
  new(
    version: version,
    type: type,
    split_by: split_by,
    splits: splits,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


88
89
90
91
92
93
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 88

def self.validate_raw(obj:)
  obj.version&.is_a?(String) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
  obj.type&.is_a?(Gusto::EmployeePaymentMethod::EmployeePaymentMethodType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.split_by&.is_a?(Gusto::EmployeePaymentMethod::EmployeePaymentMethodSplitBy) != false || raise("Passed value for field obj.split_by is not the expected type, validation failed.")
  obj.splits&.is_a?(Array) != false || raise("Passed value for field obj.splits is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


79
80
81
# File 'lib/fern_gusto/employee_payment_method/types/employee_payment_method_info.rb', line 79

def to_json
  @_field_set&.to_json
end