Class: Merge::Crm::CommonModelScopesBodyRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_id:, enabled_actions:, disabled_fields:, additional_properties: nil) ⇒ Merge::Crm::CommonModelScopesBodyRequest

Parameters:

  • model_id (String)
  • enabled_actions (Array<Merge::Crm::EnabledActionsEnum>)
  • disabled_fields (Array<String>)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 29

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



17
18
19
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 17

def additional_properties
  @additional_properties
end

#disabled_fieldsArray<String> (readonly)

Returns:

  • (Array<String>)


15
16
17
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 15

def disabled_fields
  @disabled_fields
end

#enabled_actionsArray<Merge::Crm::EnabledActionsEnum> (readonly)

Returns:



13
14
15
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 13

def enabled_actions
  @enabled_actions
end

#model_idString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 11

def model_id
  @model_id
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Crm::CommonModelScopesBodyRequest

Deserialize a JSON object to an instance of CommonModelScopesBodyRequest

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 41

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

Parameters:

  • obj (Object)

Returns:

  • (Void)


68
69
70
71
72
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 68

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CommonModelScopesBodyRequest to a JSON object

Returns:

  • (String)


58
59
60
# File 'lib/merge_ruby_client/crm/types/common_model_scopes_body_request.rb', line 58

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