Class: Merge::Ats::AccountDetailsAndActionsIntegration

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/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::Ats::AccountDetailsAndActionsIntegration



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/ats/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)



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

def additional_properties
  @additional_properties
end

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



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

def available_model_operations
  @available_model_operations
end

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



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

def categories
  @categories
end

#colorString (readonly)



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

def color
  @color
end

#imageString (readonly)



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

def image
  @image
end

#nameString (readonly)



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

def name
  @name
end

#passthrough_availableBoolean (readonly)



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

def passthrough_available
  @passthrough_available
end

#slugString (readonly)



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

def slug
  @slug
end

#square_imageString (readonly)



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

def square_image
  @square_image
end

Class Method Details

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

Deserialize a JSON object to an instance of AccountDetailsAndActionsIntegration



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/ats/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::Ats::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.


114
115
116
117
118
119
120
121
122
123
# File 'lib/merge_ruby_client/ats/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



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

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