Class: Merge::Hris::RemoteFieldApi

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema:, remote_key_name:, remote_endpoint_info:, example_values: OMIT, advanced_metadata: OMIT, coverage: OMIT, additional_properties: nil) ⇒ Merge::Hris::RemoteFieldApi

Parameters:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 40

def initialize(schema:, remote_key_name:, remote_endpoint_info:, example_values: OMIT, advanced_metadata: OMIT,
               coverage: OMIT, additional_properties: nil)
  @schema = schema
  @remote_key_name = remote_key_name
  @remote_endpoint_info = remote_endpoint_info
  @example_values = example_values if example_values != OMIT
  @advanced_metadata =  if  != OMIT
  @coverage = coverage if coverage != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "schema": schema,
    "remote_key_name": remote_key_name,
    "remote_endpoint_info": remote_endpoint_info,
    "example_values": example_values,
    "advanced_metadata": ,
    "coverage": coverage
  }.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



25
26
27
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 25

def additional_properties
  @additional_properties
end

#advanced_metadataMerge::Hris::AdvancedMetadata (readonly)



21
22
23
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 21

def 
  @advanced_metadata
end

#coverageMerge::Hris::RemoteFieldApiCoverage (readonly)



23
24
25
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 23

def coverage
  @coverage
end

#example_valuesArray<Object> (readonly)

Returns:

  • (Array<Object>)


19
20
21
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 19

def example_values
  @example_values
end

#remote_endpoint_infoMerge::Hris::RemoteEndpointInfo (readonly)



17
18
19
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 17

def remote_endpoint_info
  @remote_endpoint_info
end

#remote_key_nameString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 15

def remote_key_name
  @remote_key_name
end

#schemaHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


13
14
15
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 13

def schema
  @schema
end

Class Method Details

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

Deserialize a JSON object to an instance of RemoteFieldApi

Parameters:

  • json_object (String)

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 65

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  schema = parsed_json["schema"]
  remote_key_name = parsed_json["remote_key_name"]
  if parsed_json["remote_endpoint_info"].nil?
    remote_endpoint_info = nil
  else
    remote_endpoint_info = parsed_json["remote_endpoint_info"].to_json
    remote_endpoint_info = Merge::Hris::RemoteEndpointInfo.from_json(json_object: remote_endpoint_info)
  end
  example_values = parsed_json["example_values"]
  if parsed_json["advanced_metadata"].nil?
     = nil
  else
     = parsed_json["advanced_metadata"].to_json
     = Merge::Hris::AdvancedMetadata.from_json(json_object: )
  end
  if parsed_json["coverage"].nil?
    coverage = nil
  else
    coverage = parsed_json["coverage"].to_json
    coverage = Merge::Hris::RemoteFieldApiCoverage.from_json(json_object: coverage)
  end
  new(
    schema: schema,
    remote_key_name: remote_key_name,
    remote_endpoint_info: remote_endpoint_info,
    example_values: example_values,
    advanced_metadata: ,
    coverage: coverage,
    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)


113
114
115
116
117
118
119
120
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 113

def self.validate_raw(obj:)
  obj.schema.is_a?(Hash) != false || raise("Passed value for field obj.schema is not the expected type, validation failed.")
  obj.remote_key_name.is_a?(String) != false || raise("Passed value for field obj.remote_key_name is not the expected type, validation failed.")
  Merge::Hris::RemoteEndpointInfo.validate_raw(obj: obj.remote_endpoint_info)
  obj.example_values&.is_a?(Array) != false || raise("Passed value for field obj.example_values is not the expected type, validation failed.")
  obj..nil? || Merge::Hris::AdvancedMetadata.validate_raw(obj: obj.)
  obj.coverage.nil? || Merge::Hris::RemoteFieldApiCoverage.validate_raw(obj: obj.coverage)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RemoteFieldApi to a JSON object

Returns:

  • (String)


103
104
105
# File 'lib/merge_ruby_client/hris/types/remote_field_api.rb', line 103

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