Class: TrophyApiClient::UpdatePointsSystemRequestItem

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

Overview

A points system update object. Only id is required; all other fields are

optional.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name: OMIT, description: OMIT, badge: OMIT, max_points: OMIT, additional_properties: nil) ⇒ TrophyApiClient::UpdatePointsSystemRequestItem

Parameters:

  • id (String)

    The UUID of the points system to update.

  • name (String) (defaults to: OMIT)

    Updated name.

  • description (String) (defaults to: OMIT)

    Updated description.

  • badge (TrophyApiClient::UpdatePointsSystemRequestItemBadge) (defaults to: OMIT)

    Updated badge. Set to null to remove.

  • max_points (Integer) (defaults to: OMIT)

    Updated max points. Set to null to remove.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 36

def initialize(id:, name: OMIT, description: OMIT, badge: OMIT, max_points: OMIT, additional_properties: nil)
  @id = id
  @name = name if name != OMIT
  @description = description if description != OMIT
  @badge = badge if badge != OMIT
  @max_points = max_points if max_points != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "name": name,
    "description": description,
    "badge": badge,
    "maxPoints": max_points
  }.reject do |_k, v|
    v == OMIT
  end
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



22
23
24
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 22

def additional_properties
  @additional_properties
end

#badgeTrophyApiClient::UpdatePointsSystemRequestItemBadge (readonly)

Returns Updated badge. Set to null to remove.

Returns:



18
19
20
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 18

def badge
  @badge
end

#descriptionString (readonly)

Returns Updated description.

Returns:

  • (String)

    Updated description.



16
17
18
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 16

def description
  @description
end

#idString (readonly)

Returns The UUID of the points system to update.

Returns:

  • (String)

    The UUID of the points system to update.



12
13
14
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 12

def id
  @id
end

#max_pointsInteger (readonly)

Returns Updated max points. Set to null to remove.

Returns:

  • (Integer)

    Updated max points. Set to null to remove.



20
21
22
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 20

def max_points
  @max_points
end

#nameString (readonly)

Returns Updated name.

Returns:

  • (String)

    Updated name.



14
15
16
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 14

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::UpdatePointsSystemRequestItem

Deserialize a JSON object to an instance of UpdatePointsSystemRequestItem

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  name = parsed_json["name"]
  description = parsed_json["description"]
  if parsed_json["badge"].nil?
    badge = nil
  else
    badge = parsed_json["badge"].to_json
    badge = TrophyApiClient::UpdatePointsSystemRequestItemBadge.from_json(json_object: badge)
  end
  max_points = parsed_json["maxPoints"]
  new(
    id: id,
    name: name,
    description: description,
    badge: badge,
    max_points: max_points,
    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)


94
95
96
97
98
99
100
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 94

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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.badge.nil? || TrophyApiClient::UpdatePointsSystemRequestItemBadge.validate_raw(obj: obj.badge)
  obj.max_points&.is_a?(Integer) != false || raise("Passed value for field obj.max_points is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of UpdatePointsSystemRequestItem to a JSON object

Returns:

  • (String)


84
85
86
# File 'lib/trophy_api_client/types/update_points_system_request_item.rb', line 84

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