Class: TrophyApiClient::AdminIssue
- Inherits:
-
Object
- Object
- TrophyApiClient::AdminIssue
- Defined in:
- lib/trophy_api_client/types/admin_issue.rb
Overview
An issue encountered while processing an item in an admin API request.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#boost_id ⇒ String
readonly
The ID of the points boost the issue relates to, when applicable.
-
#index ⇒ Integer
readonly
The zero-based index of the item the issue relates to, when no resource ID exists yet.
-
#message ⇒ String
readonly
A human-readable description of the issue.
-
#severity ⇒ TrophyApiClient::AdminIssueSeverity
readonly
The severity level of the issue.
-
#user_id ⇒ String
readonly
The ID of the user the issue relates to, when applicable.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::AdminIssue
Deserialize a JSON object to an instance of AdminIssue.
-
.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(severity:, message:, user_id: OMIT, boost_id: OMIT, index: OMIT, additional_properties: nil) ⇒ TrophyApiClient::AdminIssue constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AdminIssue to a JSON object.
Constructor Details
#initialize(severity:, message:, user_id: OMIT, boost_id: OMIT, index: OMIT, additional_properties: nil) ⇒ TrophyApiClient::AdminIssue
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 37 def initialize(severity:, message:, user_id: OMIT, boost_id: OMIT, index: OMIT, additional_properties: nil) @user_id = user_id if user_id != OMIT @boost_id = boost_id if boost_id != OMIT @index = index if index != OMIT @severity = severity @message = @additional_properties = additional_properties @_field_set = { "userId": user_id, "boostId": boost_id, "index": index, "severity": severity, "message": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 22 def additional_properties @additional_properties end |
#boost_id ⇒ String (readonly)
Returns The ID of the points boost the issue relates to, when applicable.
13 14 15 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 13 def boost_id @boost_id end |
#index ⇒ Integer (readonly)
Returns The zero-based index of the item the issue relates to, when no resource ID exists yet.
16 17 18 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 16 def index @index end |
#message ⇒ String (readonly)
Returns A human-readable description of the issue.
20 21 22 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 20 def @message end |
#severity ⇒ TrophyApiClient::AdminIssueSeverity (readonly)
Returns The severity level of the issue.
18 19 20 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 18 def severity @severity end |
#user_id ⇒ String (readonly)
Returns The ID of the user the issue relates to, when applicable.
11 12 13 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 11 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::AdminIssue
Deserialize a JSON object to an instance of AdminIssue
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 59 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) user_id = parsed_json["userId"] boost_id = parsed_json["boostId"] index = parsed_json["index"] severity = parsed_json["severity"] = parsed_json["message"] new( user_id: user_id, boost_id: boost_id, index: index, severity: severity, message: , 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.
90 91 92 93 94 95 96 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 90 def self.validate_raw(obj:) obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.") obj.boost_id&.is_a?(String) != false || raise("Passed value for field obj.boost_id is not the expected type, validation failed.") obj.index&.is_a?(Integer) != false || raise("Passed value for field obj.index is not the expected type, validation failed.") obj.severity.is_a?(TrophyApiClient::AdminIssueSeverity) != false || raise("Passed value for field obj.severity is not the expected type, validation failed.") obj..is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AdminIssue to a JSON object
80 81 82 |
# File 'lib/trophy_api_client/types/admin_issue.rb', line 80 def to_json(*_args) @_field_set&.to_json end |