Class: Merge::Crm::ModelOperation
- Inherits:
-
Object
- Object
- Merge::Crm::ModelOperation
- Defined in:
- lib/merge_ruby_client/crm/types/model_operation.rb
Overview
# The ModelOperation Object
### Description
The `ModelOperation` object is used to represent the operations that are
currently supported for a given model.
### Usage Example
View what operations are supported for the `Candidate` endpoint.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #available_operations ⇒ Array<String> readonly
- #model_name ⇒ String readonly
- #required_post_parameters ⇒ Array<String> readonly
- #supported_fields ⇒ Array<String> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::ModelOperation
Deserialize a JSON object to an instance of ModelOperation.
-
.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(model_name:, available_operations:, required_post_parameters:, supported_fields:, additional_properties: nil) ⇒ Merge::Crm::ModelOperation constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ModelOperation to a JSON object.
Constructor Details
#initialize(model_name:, available_operations:, required_post_parameters:, supported_fields:, additional_properties: nil) ⇒ Merge::Crm::ModelOperation
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 37 def initialize(model_name:, available_operations:, required_post_parameters:, supported_fields:, additional_properties: nil) @model_name = model_name @available_operations = available_operations @required_post_parameters = required_post_parameters @supported_fields = supported_fields @additional_properties = additional_properties @_field_set = { "model_name": model_name, "available_operations": available_operations, "required_post_parameters": required_post_parameters, "supported_fields": supported_fields } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 24 def additional_properties @additional_properties end |
#available_operations ⇒ Array<String> (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 18 def available_operations @available_operations end |
#model_name ⇒ String (readonly)
16 17 18 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 16 def model_name @model_name end |
#required_post_parameters ⇒ Array<String> (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 20 def required_post_parameters @required_post_parameters end |
#supported_fields ⇒ Array<String> (readonly)
22 23 24 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 22 def supported_fields @supported_fields end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::ModelOperation
Deserialize a JSON object to an instance of ModelOperation
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) model_name = parsed_json["model_name"] available_operations = parsed_json["available_operations"] required_post_parameters = parsed_json["required_post_parameters"] supported_fields = parsed_json["supported_fields"] new( model_name: model_name, available_operations: available_operations, required_post_parameters: required_post_parameters, supported_fields: supported_fields, 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.
85 86 87 88 89 90 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 85 def self.validate_raw(obj:) obj.model_name.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.") obj.available_operations.is_a?(Array) != false || raise("Passed value for field obj.available_operations is not the expected type, validation failed.") obj.required_post_parameters.is_a?(Array) != false || raise("Passed value for field obj.required_post_parameters is not the expected type, validation failed.") obj.supported_fields.is_a?(Array) != false || raise("Passed value for field obj.supported_fields is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ModelOperation to a JSON object
75 76 77 |
# File 'lib/merge_ruby_client/crm/types/model_operation.rb', line 75 def to_json(*_args) @_field_set&.to_json end |