Class: Gusto::PaidHolidaysSchema

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(holiday_key: OMIT, holiday_name: OMIT, start_date: OMIT, end_date: OMIT, additional_properties: nil) ⇒ Gusto::PaidHolidaysSchema

Parameters:

  • holiday_key (String) (defaults to: OMIT)

    the holiday’s identifier

  • holiday_name (String) (defaults to: OMIT)

    the holiday’s official name

  • start_date (String) (defaults to: OMIT)

    the holiday’s start date (YYYY-MM-DD)

  • end_date (String) (defaults to: OMIT)

    the holiday’s end date (YYYY-MM-DD)

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
36
37
38
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 29

def initialize(holiday_key: OMIT, holiday_name: OMIT, start_date: OMIT, end_date: OMIT, additional_properties: nil)
  @holiday_key = holiday_key if holiday_key != OMIT
  @holiday_name = holiday_name if holiday_name != OMIT
  @start_date = start_date if start_date != OMIT
  @end_date = end_date if end_date != OMIT
  @additional_properties = additional_properties
  @_field_set = { "holiday_key": holiday_key, "holiday_name": holiday_name, "start_date": start_date, "end_date": end_date }.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



16
17
18
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 16

def additional_properties
  @additional_properties
end

#end_dateString (readonly)

Returns the holiday’s end date (YYYY-MM-DD).

Returns:

  • (String)

    the holiday’s end date (YYYY-MM-DD)



14
15
16
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 14

def end_date
  @end_date
end

#holiday_keyString (readonly)

Returns the holiday’s identifier.

Returns:

  • (String)

    the holiday’s identifier



8
9
10
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 8

def holiday_key
  @holiday_key
end

#holiday_nameString (readonly)

Returns the holiday’s official name.

Returns:

  • (String)

    the holiday’s official name



10
11
12
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 10

def holiday_name
  @holiday_name
end

#start_dateString (readonly)

Returns the holiday’s start date (YYYY-MM-DD).

Returns:

  • (String)

    the holiday’s start date (YYYY-MM-DD)



12
13
14
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 12

def start_date
  @start_date
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::PaidHolidaysSchema

Parameters:

  • json_object (String)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 43

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  holiday_key = parsed_json["holiday_key"]
  holiday_name = parsed_json["holiday_name"]
  start_date = parsed_json["start_date"]
  end_date = parsed_json["end_date"]
  new(
    holiday_key: holiday_key,
    holiday_name: holiday_name,
    start_date: start_date,
    end_date: end_date,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
74
75
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 70

def self.validate_raw(obj:)
  obj.holiday_key&.is_a?(String) != false || raise("Passed value for field obj.holiday_key is not the expected type, validation failed.")
  obj.holiday_name&.is_a?(String) != false || raise("Passed value for field obj.holiday_name is not the expected type, validation failed.")
  obj.start_date&.is_a?(String) != false || raise("Passed value for field obj.start_date is not the expected type, validation failed.")
  obj.end_date&.is_a?(String) != false || raise("Passed value for field obj.end_date is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


61
62
63
# File 'lib/fern_gusto/types/paid_holidays_schema.rb', line 61

def to_json
  @_field_set&.to_json
end