Class: Merge::Crm::Issue
- Inherits:
-
Object
- Object
- Merge::Crm::Issue
- Defined in:
- lib/merge_ruby_client/crm/types/issue.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #end_user ⇒ Hash{String => Object} readonly
- #error_description ⇒ String readonly
- #error_details ⇒ Array<String> readonly
- #first_incident_time ⇒ DateTime readonly
- #id ⇒ String readonly
- #is_muted ⇒ Boolean readonly
- #last_incident_time ⇒ DateTime readonly
-
#status ⇒ Merge::Crm::IssueStatusEnum
readonly
Status of the issue.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Crm::Issue
Deserialize a JSON object to an instance of Issue.
-
.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(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::Crm::Issue constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Issue to a JSON object.
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::Crm::Issue
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/crm/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_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 30 def additional_properties @additional_properties end |
#end_user ⇒ Hash{String => Object} (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 20 def end_user @end_user end |
#error_description ⇒ String (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 18 def error_description @error_description end |
#error_details ⇒ Array<String> (readonly)
28 29 30 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 28 def error_details @error_details end |
#first_incident_time ⇒ DateTime (readonly)
22 23 24 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 22 def first_incident_time @first_incident_time end |
#id ⇒ String (readonly)
12 13 14 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 12 def id @id end |
#is_muted ⇒ Boolean (readonly)
26 27 28 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 26 def is_muted @is_muted end |
#last_incident_time ⇒ DateTime (readonly)
24 25 26 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 24 def last_incident_time @last_incident_time end |
#status ⇒ Merge::Crm::IssueStatusEnum (readonly)
Returns Status of the issue. Options: (‘ONGOING’, ‘RESOLVED’)
-
‘ONGOING` - ONGOING
-
‘RESOLVED` - RESOLVED.
16 17 18 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 16 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Crm::Issue
Deserialize a JSON object to an instance of Issue
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/crm/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.
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/merge_ruby_client/crm/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::Crm::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
109 110 111 |
# File 'lib/merge_ruby_client/crm/types/issue.rb', line 109 def to_json(*_args) @_field_set&.to_json end |