Class: TrophyApiClient::UpdateAttributesResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/trophy_api_client/types/update_attributes_response.rb

Overview

Response containing updated attributes and any per-item issues identified by

attribute ID.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(updated:, issues:, additional_properties: nil) ⇒ TrophyApiClient::UpdateAttributesResponse

Parameters:

  • updated (Array<TrophyApiClient::AdminAttribute>)

    Array of successfully updated attributes.

  • issues (Array<TrophyApiClient::AdminIssue>)

    Array of issues encountered during attribute update.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 28

def initialize(updated:, issues:, additional_properties: nil)
  @updated = updated
  @issues = issues
  @additional_properties = additional_properties
  @_field_set = { "updated": updated, "issues": issues }
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



17
18
19
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 17

def additional_properties
  @additional_properties
end

#issuesArray<TrophyApiClient::AdminIssue> (readonly)

Returns Array of issues encountered during attribute update.

Returns:



15
16
17
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 15

def issues
  @issues
end

#updatedArray<TrophyApiClient::AdminAttribute> (readonly)

Returns Array of successfully updated attributes.

Returns:



13
14
15
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 13

def updated
  @updated
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::UpdateAttributesResponse

Deserialize a JSON object to an instance of UpdateAttributesResponse

Parameters:

  • json_object (String)

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 39

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  updated = parsed_json["updated"]&.map do |item|
    item = item.to_json
    TrophyApiClient::AdminAttribute.from_json(json_object: item)
  end
  issues = parsed_json["issues"]&.map do |item|
    item = item.to_json
    TrophyApiClient::AdminIssue.from_json(json_object: item)
  end
  new(
    updated: updated,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 70

def self.validate_raw(obj:)
  obj.updated.is_a?(Array) != false || raise("Passed value for field obj.updated 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 UpdateAttributesResponse to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/trophy_api_client/types/update_attributes_response.rb', line 60

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