Class: Merge::Ticketing::CommentRequest
- Inherits:
-
Object
- Object
- Merge::Ticketing::CommentRequest
- Defined in:
- lib/merge_ruby_client/ticketing/types/comment_request.rb
Overview
# The Comment Object
### Description
The `Comment` object is used to represent a comment on a ticket.
### Usage Example
TODO
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#body ⇒ String
readonly
The comment’s text body.
-
#contact ⇒ Merge::Ticketing::CommentRequestContact
readonly
The author of the Comment, if the author is a Contact.
-
#html_body ⇒ String
readonly
The comment’s text body formatted as html.
- #integration_params ⇒ Hash{String => Object} readonly
-
#is_private ⇒ Boolean
readonly
Whether or not the comment is internal.
- #linked_account_params ⇒ Hash{String => Object} readonly
-
#ticket ⇒ Merge::Ticketing::CommentRequestTicket
readonly
The ticket associated with the comment.
-
#user ⇒ Merge::Ticketing::CommentRequestUser
readonly
The author of the Comment, if the author is a User.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Ticketing::CommentRequest
Deserialize a JSON object to an instance of CommentRequest.
-
.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(user: OMIT, contact: OMIT, body: OMIT, html_body: OMIT, ticket: OMIT, is_private: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::CommentRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CommentRequest to a JSON object.
Constructor Details
#initialize(user: OMIT, contact: OMIT, body: OMIT, html_body: OMIT, ticket: OMIT, is_private: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::CommentRequest
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 51 def initialize(user: OMIT, contact: OMIT, body: OMIT, html_body: OMIT, ticket: OMIT, is_private: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) @user = user if user != OMIT @contact = contact if contact != OMIT @body = body if body != OMIT @html_body = html_body if html_body != OMIT @ticket = ticket if ticket != OMIT @is_private = is_private if is_private != OMIT @integration_params = integration_params if integration_params != OMIT @linked_account_params = linked_account_params if linked_account_params != OMIT @additional_properties = additional_properties @_field_set = { "user": user, "contact": contact, "body": body, "html_body": html_body, "ticket": ticket, "is_private": is_private, "integration_params": integration_params, "linked_account_params": linked_account_params }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
34 35 36 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 34 def additional_properties @additional_properties end |
#body ⇒ String (readonly)
Returns The comment’s text body.
22 23 24 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 22 def body @body end |
#contact ⇒ Merge::Ticketing::CommentRequestContact (readonly)
Returns The author of the Comment, if the author is a Contact.
20 21 22 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 20 def contact @contact end |
#html_body ⇒ String (readonly)
Returns The comment’s text body formatted as html.
24 25 26 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 24 def html_body @html_body end |
#integration_params ⇒ Hash{String => Object} (readonly)
30 31 32 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 30 def integration_params @integration_params end |
#is_private ⇒ Boolean (readonly)
Returns Whether or not the comment is internal.
28 29 30 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 28 def is_private @is_private end |
#linked_account_params ⇒ Hash{String => Object} (readonly)
32 33 34 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 32 def linked_account_params @linked_account_params end |
#ticket ⇒ Merge::Ticketing::CommentRequestTicket (readonly)
Returns The ticket associated with the comment.
26 27 28 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 26 def ticket @ticket end |
#user ⇒ Merge::Ticketing::CommentRequestUser (readonly)
Returns The author of the Comment, if the author is a User.
18 19 20 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 18 def user @user end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Ticketing::CommentRequest
Deserialize a JSON object to an instance of CommentRequest
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 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 80 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["user"].nil? user = nil else user = parsed_json["user"].to_json user = Merge::Ticketing::CommentRequestUser.from_json(json_object: user) end if parsed_json["contact"].nil? contact = nil else contact = parsed_json["contact"].to_json contact = Merge::Ticketing::CommentRequestContact.from_json(json_object: contact) end body = parsed_json["body"] html_body = parsed_json["html_body"] if parsed_json["ticket"].nil? ticket = nil else ticket = parsed_json["ticket"].to_json ticket = Merge::Ticketing::CommentRequestTicket.from_json(json_object: ticket) end is_private = parsed_json["is_private"] integration_params = parsed_json["integration_params"] linked_account_params = parsed_json["linked_account_params"] new( user: user, contact: contact, body: body, html_body: html_body, ticket: ticket, is_private: is_private, integration_params: integration_params, linked_account_params: linked_account_params, 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.
132 133 134 135 136 137 138 139 140 141 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 132 def self.validate_raw(obj:) obj.user.nil? || Merge::Ticketing::CommentRequestUser.validate_raw(obj: obj.user) obj.contact.nil? || Merge::Ticketing::CommentRequestContact.validate_raw(obj: obj.contact) obj.body&.is_a?(String) != false || raise("Passed value for field obj.body is not the expected type, validation failed.") obj.html_body&.is_a?(String) != false || raise("Passed value for field obj.html_body is not the expected type, validation failed.") obj.ticket.nil? || Merge::Ticketing::CommentRequestTicket.validate_raw(obj: obj.ticket) obj.is_private&.is_a?(Boolean) != false || raise("Passed value for field obj.is_private is not the expected type, validation failed.") obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.") obj.linked_account_params&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CommentRequest to a JSON object
122 123 124 |
# File 'lib/merge_ruby_client/ticketing/types/comment_request.rb', line 122 def to_json(*_args) @_field_set&.to_json end |