Class: Merge::Ticketing::RemoteFieldRequest
- Inherits:
-
Object
- Object
- Merge::Ticketing::RemoteFieldRequest
- Defined in:
- lib/merge_ruby_client/ticketing/types/remote_field_request.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #remote_field_class ⇒ Merge::Ticketing::RemoteFieldRequestRemoteFieldClass readonly
- #value ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Ticketing::RemoteFieldRequest
Deserialize a JSON object to an instance of RemoteFieldRequest.
-
.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(remote_field_class:, value: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::RemoteFieldRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RemoteFieldRequest to a JSON object.
Constructor Details
#initialize(remote_field_class:, value: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::RemoteFieldRequest
26 27 28 29 30 31 32 33 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 26 def initialize(remote_field_class:, value: OMIT, additional_properties: nil) @remote_field_class = remote_field_class @value = value if value != OMIT @additional_properties = additional_properties @_field_set = { "remote_field_class": remote_field_class, "value": value }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 15 def additional_properties @additional_properties end |
#remote_field_class ⇒ Merge::Ticketing::RemoteFieldRequestRemoteFieldClass (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 11 def remote_field_class @remote_field_class end |
#value ⇒ String (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 13 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Ticketing::RemoteFieldRequest
Deserialize a JSON object to an instance of RemoteFieldRequest
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["remote_field_class"].nil? remote_field_class = nil else remote_field_class = parsed_json["remote_field_class"].to_json remote_field_class = Merge::Ticketing::RemoteFieldRequestRemoteFieldClass.from_json(json_object: remote_field_class) end value = parsed_json["value"] new( remote_field_class: remote_field_class, value: value, 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.
69 70 71 72 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 69 def self.validate_raw(obj:) Merge::Ticketing::RemoteFieldRequestRemoteFieldClass.validate_raw(obj: obj.remote_field_class) obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of RemoteFieldRequest to a JSON object
59 60 61 |
# File 'lib/merge_ruby_client/ticketing/types/remote_field_request.rb', line 59 def to_json(*_args) @_field_set&.to_json end |