Class: TrophyApiClient::UpdateLeaderboardRequestItem

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

Overview

A leaderboard update object. ‘id` is required. Once a leaderboard has been

activated, the dashboard-imposed restrictions on ranking configuration and
scheduling changes still apply.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name: OMIT, key: OMIT, description: OMIT, status: OMIT, rank_by: OMIT, metric_id: OMIT, points_system_id: OMIT, max_participants: OMIT, start: OMIT, end_: OMIT, breakdown_attributes: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil) ⇒ TrophyApiClient::UpdateLeaderboardRequestItem

Parameters:

  • id (String)

    The UUID of the leaderboard to update.

  • name (String) (defaults to: OMIT)

    The updated leaderboard name.

  • key (String) (defaults to: OMIT)

    The updated leaderboard key. This can only be changed while the leaderboard is inactive.

  • description (String) (defaults to: OMIT)

    The updated leaderboard description.

  • status (TrophyApiClient::UpdateLeaderboardRequestItemStatus) (defaults to: OMIT)

    The target user-facing status. ‘scheduled` activates a leaderboard whose start date is in the future. `finished` behaves like the dashboard finish action.

  • rank_by (TrophyApiClient::UpdateLeaderboardRequestItemRankBy) (defaults to: OMIT)

    The updated ranking criterion. This can only be changed while the leaderboard is inactive.

  • metric_id (String) (defaults to: OMIT)

    The metric ID to use when ‘rankBy` is `metric`.

  • points_system_id (String) (defaults to: OMIT)

    The points system ID to use when ‘rankBy` is `points`.

  • max_participants (Integer) (defaults to: OMIT)

    The updated maximum number of participants.

  • start (String) (defaults to: OMIT)

    The updated start date in YYYY-MM-DD format.

  • end_ (String) (defaults to: OMIT)

    The updated end date in YYYY-MM-DD format, or ‘null` to clear it.

  • breakdown_attributes (Array<String>) (defaults to: OMIT)

    The updated breakdown attribute UUIDs.

  • run_unit (TrophyApiClient::UpdateLeaderboardRequestItemRunUnit) (defaults to: OMIT)

    The updated recurrence unit.

  • run_interval (Integer) (defaults to: OMIT)

    The updated recurrence interval.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



72
73
74
75
76
77
78
79
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
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 72

def initialize(id:, name: OMIT, key: OMIT, description: OMIT, status: OMIT, rank_by: OMIT, metric_id: OMIT,
               points_system_id: OMIT, max_participants: OMIT, start: OMIT, end_: OMIT, breakdown_attributes: OMIT, run_unit: OMIT, run_interval: OMIT, additional_properties: nil)
  @id = id
  @name = name if name != OMIT
  @key = key if key != OMIT
  @description = description if description != OMIT
  @status = status if status != OMIT
  @rank_by = rank_by if rank_by != OMIT
  @metric_id = metric_id if metric_id != OMIT
  @points_system_id = points_system_id if points_system_id != OMIT
  @max_participants = max_participants if max_participants != OMIT
  @start = start if start != OMIT
  @end_ = end_ if end_ != OMIT
  @breakdown_attributes = breakdown_attributes if breakdown_attributes != OMIT
  @run_unit = run_unit if run_unit != OMIT
  @run_interval = run_interval if run_interval != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "id": id,
    "name": name,
    "key": key,
    "description": description,
    "status": status,
    "rankBy": rank_by,
    "metricId": metric_id,
    "pointsSystemId": points_system_id,
    "maxParticipants": max_participants,
    "start": start,
    "end": end_,
    "breakdownAttributes": breakdown_attributes,
    "runUnit": run_unit,
    "runInterval": run_interval
  }.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



46
47
48
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 46

def additional_properties
  @additional_properties
end

#breakdown_attributesArray<String> (readonly)

Returns The updated breakdown attribute UUIDs.

Returns:

  • (Array<String>)

    The updated breakdown attribute UUIDs.



40
41
42
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 40

def breakdown_attributes
  @breakdown_attributes
end

#descriptionString (readonly)

Returns The updated leaderboard description.

Returns:

  • (String)

    The updated leaderboard description.



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

def description
  @description
end

#end_String (readonly)

Returns The updated end date in YYYY-MM-DD format, or ‘null` to clear it.

Returns:

  • (String)

    The updated end date in YYYY-MM-DD format, or ‘null` to clear it.



38
39
40
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 38

def end_
  @end_
end

#idString (readonly)

Returns The UUID of the leaderboard to update.

Returns:

  • (String)

    The UUID of the leaderboard to update.



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

def id
  @id
end

#keyString (readonly)

Returns The updated leaderboard key. This can only be changed while the leaderboard is inactive.

Returns:

  • (String)

    The updated leaderboard key. This can only be changed while the leaderboard is inactive.



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

def key
  @key
end

#max_participantsInteger (readonly)

Returns The updated maximum number of participants.

Returns:

  • (Integer)

    The updated maximum number of participants.



34
35
36
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 34

def max_participants
  @max_participants
end

#metric_idString (readonly)

Returns The metric ID to use when ‘rankBy` is `metric`.

Returns:

  • (String)

    The metric ID to use when ‘rankBy` is `metric`.



30
31
32
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 30

def metric_id
  @metric_id
end

#nameString (readonly)

Returns The updated leaderboard name.

Returns:

  • (String)

    The updated leaderboard name.



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

def name
  @name
end

#points_system_idString (readonly)

Returns The points system ID to use when ‘rankBy` is `points`.

Returns:

  • (String)

    The points system ID to use when ‘rankBy` is `points`.



32
33
34
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 32

def points_system_id
  @points_system_id
end

#rank_byTrophyApiClient::UpdateLeaderboardRequestItemRankBy (readonly)

Returns The updated ranking criterion. This can only be changed while the leaderboard is inactive.

Returns:



28
29
30
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 28

def rank_by
  @rank_by
end

#run_intervalInteger (readonly)

Returns The updated recurrence interval.

Returns:

  • (Integer)

    The updated recurrence interval.



44
45
46
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 44

def run_interval
  @run_interval
end

#run_unitTrophyApiClient::UpdateLeaderboardRequestItemRunUnit (readonly)

Returns The updated recurrence unit.

Returns:



42
43
44
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 42

def run_unit
  @run_unit
end

#startString (readonly)

Returns The updated start date in YYYY-MM-DD format.

Returns:

  • (String)

    The updated start date in YYYY-MM-DD format.



36
37
38
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 36

def start
  @start
end

#statusTrophyApiClient::UpdateLeaderboardRequestItemStatus (readonly)

Returns The target user-facing status. ‘scheduled` activates a leaderboard whose start date is in the future. `finished` behaves like the dashboard finish action.

Returns:



25
26
27
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 25

def status
  @status
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::UpdateLeaderboardRequestItem

Deserialize a JSON object to an instance of UpdateLeaderboardRequestItem

Parameters:

  • json_object (String)

Returns:



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 113

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"]
  key = parsed_json["key"]
  description = parsed_json["description"]
  status = parsed_json["status"]
  rank_by = parsed_json["rankBy"]
  metric_id = parsed_json["metricId"]
  points_system_id = parsed_json["pointsSystemId"]
  max_participants = parsed_json["maxParticipants"]
  start = parsed_json["start"]
  end_ = parsed_json["end"]
  breakdown_attributes = parsed_json["breakdownAttributes"]
  run_unit = parsed_json["runUnit"]
  run_interval = parsed_json["runInterval"]
  new(
    id: id,
    name: name,
    key: key,
    description: description,
    status: status,
    rank_by: rank_by,
    metric_id: metric_id,
    points_system_id: points_system_id,
    max_participants: max_participants,
    start: start,
    end_: end_,
    breakdown_attributes: breakdown_attributes,
    run_unit: run_unit,
    run_interval: run_interval,
    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)


162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 162

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.key&.is_a?(String) != false || raise("Passed value for field obj.key 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.status&.is_a?(TrophyApiClient::UpdateLeaderboardRequestItemStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
  obj.rank_by&.is_a?(TrophyApiClient::UpdateLeaderboardRequestItemRankBy) != false || raise("Passed value for field obj.rank_by is not the expected type, validation failed.")
  obj.metric_id&.is_a?(String) != false || raise("Passed value for field obj.metric_id is not the expected type, validation failed.")
  obj.points_system_id&.is_a?(String) != false || raise("Passed value for field obj.points_system_id is not the expected type, validation failed.")
  obj.max_participants&.is_a?(Integer) != false || raise("Passed value for field obj.max_participants is not the expected type, validation failed.")
  obj.start&.is_a?(String) != false || raise("Passed value for field obj.start is not the expected type, validation failed.")
  obj.end_&.is_a?(String) != false || raise("Passed value for field obj.end_ is not the expected type, validation failed.")
  obj.breakdown_attributes&.is_a?(Array) != false || raise("Passed value for field obj.breakdown_attributes is not the expected type, validation failed.")
  obj.run_unit&.is_a?(TrophyApiClient::UpdateLeaderboardRequestItemRunUnit) != false || raise("Passed value for field obj.run_unit is not the expected type, validation failed.")
  obj.run_interval&.is_a?(Integer) != false || raise("Passed value for field obj.run_interval is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of UpdateLeaderboardRequestItem to a JSON object

Returns:

  • (String)


152
153
154
# File 'lib/trophy_api_client/types/update_leaderboard_request_item.rb', line 152

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