Class: Merge::Hris::AdvancedMetadata
- Inherits:
-
Object
- Object
- Merge::Hris::AdvancedMetadata
- Defined in:
- lib/merge_ruby_client/hris/types/advanced_metadata.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #description ⇒ String readonly
- #display_name ⇒ String readonly
- #field_choices ⇒ Array<Object> readonly
- #id ⇒ String readonly
- #is_custom ⇒ Boolean readonly
- #is_required ⇒ Boolean readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Hris::AdvancedMetadata
Deserialize a JSON object to an instance of AdvancedMetadata.
-
.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.
Instance Method Summary collapse
- #initialize(id:, display_name: OMIT, description: OMIT, is_required: OMIT, is_custom: OMIT, field_choices: OMIT, additional_properties: nil) ⇒ Merge::Hris::AdvancedMetadata constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AdvancedMetadata to a JSON object.
Constructor Details
#initialize(id:, display_name: OMIT, description: OMIT, is_required: OMIT, is_custom: OMIT, field_choices: OMIT, additional_properties: nil) ⇒ Merge::Hris::AdvancedMetadata
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 37 def initialize(id:, display_name: OMIT, description: OMIT, is_required: OMIT, is_custom: OMIT, field_choices: OMIT, additional_properties: nil) @id = id @display_name = display_name if display_name != OMIT @description = description if description != OMIT @is_required = is_required if is_required != OMIT @is_custom = is_custom if is_custom != OMIT @field_choices = field_choices if field_choices != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "display_name": display_name, "description": description, "is_required": is_required, "is_custom": is_custom, "field_choices": field_choices }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 22 def additional_properties @additional_properties end |
#description ⇒ String (readonly)
14 15 16 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 14 def description @description end |
#display_name ⇒ String (readonly)
12 13 14 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 12 def display_name @display_name end |
#field_choices ⇒ Array<Object> (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 20 def field_choices @field_choices end |
#id ⇒ String (readonly)
10 11 12 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 10 def id @id end |
#is_custom ⇒ Boolean (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 18 def is_custom @is_custom end |
#is_required ⇒ Boolean (readonly)
16 17 18 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 16 def is_required @is_required end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Hris::AdvancedMetadata
Deserialize a JSON object to an instance of AdvancedMetadata
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 62 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] display_name = parsed_json["display_name"] description = parsed_json["description"] is_required = parsed_json["is_required"] is_custom = parsed_json["is_custom"] field_choices = parsed_json["field_choices"] new( id: id, display_name: display_name, description: description, is_required: is_required, is_custom: is_custom, field_choices: field_choices, 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.
95 96 97 98 99 100 101 102 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 95 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.display_name&.is_a?(String) != false || raise("Passed value for field obj.display_name is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.is_required&.is_a?(Boolean) != false || raise("Passed value for field obj.is_required is not the expected type, validation failed.") obj.is_custom&.is_a?(Boolean) != false || raise("Passed value for field obj.is_custom is not the expected type, validation failed.") obj.field_choices&.is_a?(Array) != false || raise("Passed value for field obj.field_choices is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AdvancedMetadata to a JSON object
85 86 87 |
# File 'lib/merge_ruby_client/hris/types/advanced_metadata.rb', line 85 def to_json(*_args) @_field_set&.to_json end |