Class: Merge::Ats::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/types/issue.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_description:, id: OMIT, status: OMIT, end_user: OMIT, first_incident_time: OMIT, last_incident_time: OMIT, is_muted: OMIT, error_details: OMIT, additional_properties: nil) ⇒ Merge::Ats::Issue

Parameters:

  • id (String) (defaults to: OMIT)
  • status (Merge::Ats::IssueStatusEnum) (defaults to: OMIT)

    Status of the issue. Options: (‘ONGOING’, ‘RESOLVED’)

    • ‘ONGOING` - ONGOING

    • ‘RESOLVED` - RESOLVED

  • error_description (String)
  • end_user (Hash{String => Object}) (defaults to: OMIT)
  • first_incident_time (DateTime) (defaults to: OMIT)
  • last_incident_time (DateTime) (defaults to: OMIT)
  • is_muted (Boolean) (defaults to: OMIT)
  • error_details (Array<String>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/merge_ruby_client/ats/types/issue.rb', line 49

def initialize(error_description:, id: OMIT, status: OMIT, end_user: OMIT, first_incident_time: OMIT,
               last_incident_time: OMIT, is_muted: OMIT, error_details: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @status = status if status != OMIT
  @error_description = error_description
  @end_user = end_user if end_user != OMIT
  @first_incident_time = first_incident_time if first_incident_time != OMIT
  @last_incident_time = last_incident_time if last_incident_time != OMIT
  @is_muted = is_muted if is_muted != OMIT
  @error_details = error_details if error_details != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "status": status,
    "error_description": error_description,
    "end_user": end_user,
    "first_incident_time": first_incident_time,
    "last_incident_time": last_incident_time,
    "is_muted": is_muted,
    "error_details": error_details
  }.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



30
31
32
# File 'lib/merge_ruby_client/ats/types/issue.rb', line 30

def additional_properties
  @additional_properties
end

#end_userHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


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

def end_user
  @end_user
end

#error_descriptionString (readonly)

Returns:

  • (String)


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

def error_description
  @error_description
end

#error_detailsArray<String> (readonly)

Returns:

  • (Array<String>)


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

def error_details
  @error_details
end

#first_incident_timeDateTime (readonly)

Returns:

  • (DateTime)


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

def first_incident_time
  @first_incident_time
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#is_mutedBoolean (readonly)

Returns:

  • (Boolean)


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

def is_muted
  @is_muted
end

#last_incident_timeDateTime (readonly)

Returns:

  • (DateTime)


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

def last_incident_time
  @last_incident_time
end

#statusMerge::Ats::IssueStatusEnum (readonly)

Returns Status of the issue. Options: (‘ONGOING’, ‘RESOLVED’)

  • ‘ONGOING` - ONGOING

  • ‘RESOLVED` - RESOLVED.

Returns:

  • (Merge::Ats::IssueStatusEnum)

    Status of the issue. Options: (‘ONGOING’, ‘RESOLVED’)

    • ‘ONGOING` - ONGOING

    • ‘RESOLVED` - RESOLVED



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

def status
  @status
end

Class Method Details

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

Deserialize a JSON object to an instance of Issue

Parameters:

  • json_object (String)

Returns:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/merge_ruby_client/ats/types/issue.rb', line 78

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  status = parsed_json["status"]
  error_description = parsed_json["error_description"]
  end_user = parsed_json["end_user"]
  first_incident_time = unless parsed_json["first_incident_time"].nil?
                          DateTime.parse(parsed_json["first_incident_time"])
                        end
  last_incident_time = unless parsed_json["last_incident_time"].nil?
                         DateTime.parse(parsed_json["last_incident_time"])
                       end
  is_muted = parsed_json["is_muted"]
  error_details = parsed_json["error_details"]
  new(
    id: id,
    status: status,
    error_description: error_description,
    end_user: end_user,
    first_incident_time: first_incident_time,
    last_incident_time: last_incident_time,
    is_muted: is_muted,
    error_details: error_details,
    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)


119
120
121
122
123
124
125
126
127
128
# File 'lib/merge_ruby_client/ats/types/issue.rb', line 119

def self.validate_raw(obj:)
  obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.status&.is_a?(Merge::Ats::IssueStatusEnum) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.error_description.is_a?(String) != false || raise("Passed value for field obj.error_description is not the expected type, validation failed.")
  obj.end_user&.is_a?(Hash) != false || raise("Passed value for field obj.end_user is not the expected type, validation failed.")
  obj.first_incident_time&.is_a?(DateTime) != false || raise("Passed value for field obj.first_incident_time is not the expected type, validation failed.")
  obj.last_incident_time&.is_a?(DateTime) != false || raise("Passed value for field obj.last_incident_time is not the expected type, validation failed.")
  obj.is_muted&.is_a?(Boolean) != false || raise("Passed value for field obj.is_muted is not the expected type, validation failed.")
  obj.error_details&.is_a?(Array) != false || raise("Passed value for field obj.error_details is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of Issue to a JSON object

Returns:

  • (String)


109
110
111
# File 'lib/merge_ruby_client/ats/types/issue.rb', line 109

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