Class: Merge::Hris::RemoteKey

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

Overview

# The RemoteKey Object

### Description
The `RemoteKey` object is used to represent a request for a new remote key.
### Usage Example
Post a `GenerateRemoteKey` to receive a new `RemoteKey`.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, key:, additional_properties: nil) ⇒ Merge::Hris::RemoteKey

Parameters:

  • name (String)
  • key (String)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
# File 'lib/merge_ruby_client/hris/types/remote_key.rb', line 30

def initialize(name:, key:, additional_properties: nil)
  @name = name
  @key = key
  @additional_properties = additional_properties
  @_field_set = { "name": name, "key": key }
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



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

def additional_properties
  @additional_properties
end

#keyString (readonly)

Returns:

  • (String)


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

def key
  @key
end

#nameString (readonly)

Returns:

  • (String)


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

def name
  @name
end

Class Method Details

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

Deserialize a JSON object to an instance of RemoteKey

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/merge_ruby_client/hris/types/remote_key.rb', line 41

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  key = parsed_json["key"]
  new(
    name: name,
    key: key,
    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)


66
67
68
69
# File 'lib/merge_ruby_client/hris/types/remote_key.rb', line 66

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of RemoteKey to a JSON object

Returns:

  • (String)


56
57
58
# File 'lib/merge_ruby_client/hris/types/remote_key.rb', line 56

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