Class: Merge::Crm::AccountDetailsAndActionsIntegration

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, categories:, color:, slug:, passthrough_available:, image: OMIT, square_image: OMIT, available_model_operations: OMIT, additional_properties: nil) ⇒ Merge::Crm::AccountDetailsAndActionsIntegration

Parameters:

  • name (String)
  • categories (Array<Merge::Crm::CategoriesEnum>)
  • image (String) (defaults to: OMIT)
  • square_image (String) (defaults to: OMIT)
  • color (String)
  • slug (String)
  • passthrough_available (Boolean)
  • available_model_operations (Array<Merge::Crm::ModelOperation>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 45

def initialize(name:, categories:, color:, slug:, passthrough_available:, image: OMIT, square_image: OMIT,
               available_model_operations: OMIT, additional_properties: nil)
  @name = name
  @categories = categories
  @image = image if image != OMIT
  @square_image = square_image if square_image != OMIT
  @color = color
  @slug = slug
  @passthrough_available = passthrough_available
  @available_model_operations = available_model_operations if available_model_operations != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "categories": categories,
    "image": image,
    "square_image": square_image,
    "color": color,
    "slug": slug,
    "passthrough_available": passthrough_available,
    "available_model_operations": available_model_operations
  }.reject do |_k, v|
    v == OMIT
  end
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



28
29
30
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 28

def additional_properties
  @additional_properties
end

#available_model_operationsArray<Merge::Crm::ModelOperation> (readonly)

Returns:



26
27
28
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 26

def available_model_operations
  @available_model_operations
end

#categoriesArray<Merge::Crm::CategoriesEnum> (readonly)

Returns:



14
15
16
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 14

def categories
  @categories
end

#colorString (readonly)

Returns:

  • (String)


20
21
22
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 20

def color
  @color
end

#imageString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 16

def image
  @image
end

#nameString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 12

def name
  @name
end

#passthrough_availableBoolean (readonly)

Returns:

  • (Boolean)


24
25
26
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 24

def passthrough_available
  @passthrough_available
end

#slugString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 22

def slug
  @slug
end

#square_imageString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 18

def square_image
  @square_image
end

Class Method Details

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

Deserialize a JSON object to an instance of AccountDetailsAndActionsIntegration

Parameters:

  • json_object (String)

Returns:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 74

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  categories = parsed_json["categories"]
  image = parsed_json["image"]
  square_image = parsed_json["square_image"]
  color = parsed_json["color"]
  slug = parsed_json["slug"]
  passthrough_available = parsed_json["passthrough_available"]
  available_model_operations = parsed_json["available_model_operations"]&.map do |item|
    item = item.to_json
    Merge::Crm::ModelOperation.from_json(json_object: item)
  end
  new(
    name: name,
    categories: categories,
    image: image,
    square_image: square_image,
    color: color,
    slug: slug,
    passthrough_available: passthrough_available,
    available_model_operations: available_model_operations,
    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)


114
115
116
117
118
119
120
121
122
123
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 114

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.categories.is_a?(Array) != false || raise("Passed value for field obj.categories is not the expected type, validation failed.")
  obj.image&.is_a?(String) != false || raise("Passed value for field obj.image is not the expected type, validation failed.")
  obj.square_image&.is_a?(String) != false || raise("Passed value for field obj.square_image is not the expected type, validation failed.")
  obj.color.is_a?(String) != false || raise("Passed value for field obj.color is not the expected type, validation failed.")
  obj.slug.is_a?(String) != false || raise("Passed value for field obj.slug is not the expected type, validation failed.")
  obj.passthrough_available.is_a?(Boolean) != false || raise("Passed value for field obj.passthrough_available is not the expected type, validation failed.")
  obj.available_model_operations&.is_a?(Array) != false || raise("Passed value for field obj.available_model_operations is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AccountDetailsAndActionsIntegration to a JSON object

Returns:

  • (String)


104
105
106
# File 'lib/merge_ruby_client/crm/types/account_details_and_actions_integration.rb', line 104

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