Class: Merge::Crm::RemoteKey
- Inherits:
-
Object
- Object
- Merge::Crm::RemoteKey
- Defined in:
- lib/merge_ruby_client/crm/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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #key ⇒ String readonly
- #name ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::RemoteKey
Deserialize a JSON object to an instance of RemoteKey.
-
.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(name:, key:, additional_properties: nil) ⇒ Merge::Crm::RemoteKey constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RemoteKey to a JSON object.
Constructor Details
#initialize(name:, key:, additional_properties: nil) ⇒ Merge::Crm::RemoteKey
30 31 32 33 34 35 |
# File 'lib/merge_ruby_client/crm/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_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/merge_ruby_client/crm/types/remote_key.rb', line 19 def additional_properties @additional_properties end |
#key ⇒ String (readonly)
17 18 19 |
# File 'lib/merge_ruby_client/crm/types/remote_key.rb', line 17 def key @key end |
#name ⇒ String (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/crm/types/remote_key.rb', line 15 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::RemoteKey
Deserialize a JSON object to an instance of RemoteKey
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/merge_ruby_client/crm/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.
66 67 68 69 |
# File 'lib/merge_ruby_client/crm/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
56 57 58 |
# File 'lib/merge_ruby_client/crm/types/remote_key.rb', line 56 def to_json(*_args) @_field_set&.to_json end |