Class: TrophyApiClient::RestoreStreaksResponse
- Inherits:
-
Object
- Object
- TrophyApiClient::RestoreStreaksResponse
- Defined in:
- lib/trophy_api_client/types/restore_streaks_response.rb
Overview
Response containing restored users and any issues encountered.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#issues ⇒ Array<TrophyApiClient::BulkInsertIssue>
readonly
Array of issues encountered during streak restoration.
-
#restored_users ⇒ Array<String>
readonly
Array of user IDs whose streaks were successfully restored.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::RestoreStreaksResponse
Deserialize a JSON object to an instance of RestoreStreaksResponse.
-
.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(restored_users:, issues:, additional_properties: nil) ⇒ TrophyApiClient::RestoreStreaksResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of RestoreStreaksResponse to a JSON object.
Constructor Details
#initialize(restored_users:, issues:, additional_properties: nil) ⇒ TrophyApiClient::RestoreStreaksResponse
26 27 28 29 30 31 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 26 def initialize(restored_users:, issues:, additional_properties: nil) @restored_users = restored_users @issues = issues @additional_properties = additional_properties @_field_set = { "restoredUsers": restored_users, "issues": issues } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 15 def additional_properties @additional_properties end |
#issues ⇒ Array<TrophyApiClient::BulkInsertIssue> (readonly)
Returns Array of issues encountered during streak restoration.
13 14 15 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 13 def issues @issues end |
#restored_users ⇒ Array<String> (readonly)
Returns Array of user IDs whose streaks were successfully restored.
11 12 13 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 11 def restored_users @restored_users end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::RestoreStreaksResponse
Deserialize a JSON object to an instance of RestoreStreaksResponse
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) restored_users = parsed_json["restoredUsers"] issues = parsed_json["issues"]&.map do |item| item = item.to_json TrophyApiClient::BulkInsertIssue.from_json(json_object: item) end new( restored_users: restored_users, issues: issues, 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.
65 66 67 68 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 65 def self.validate_raw(obj:) obj.restored_users.is_a?(Array) != false || raise("Passed value for field obj.restored_users is not the expected type, validation failed.") obj.issues.is_a?(Array) != false || raise("Passed value for field obj.issues is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of RestoreStreaksResponse to a JSON object
55 56 57 |
# File 'lib/trophy_api_client/types/restore_streaks_response.rb', line 55 def to_json(*_args) @_field_set&.to_json end |