Class: TrophyApiClient::PointsBoostWebhookPayload
- Inherits:
-
Object
- Object
- TrophyApiClient::PointsBoostWebhookPayload
- Defined in:
- lib/trophy_api_client/types/points_boost_webhook_payload.rb
Overview
Points boost payload sent in points.boost_started and points.boost_finished
webhook events.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#end_ ⇒ String
readonly
The end date of the points boost (YYYY-MM-DD), or null if open-ended.
-
#id ⇒ String
readonly
The ID of the points boost.
-
#multiplier ⇒ Float
readonly
The multiplier applied to points during the boost.
-
#name ⇒ String
readonly
The name of the points boost.
-
#points_system_id ⇒ String
readonly
The ID of the points system this boost applies to.
-
#points_system_key ⇒ String
readonly
The key of the points system this boost applies to.
-
#points_system_name ⇒ String
readonly
The name of the points system this boost applies to.
-
#rounding ⇒ TrophyApiClient::PointsBoostWebhookPayloadRounding
readonly
The rounding method applied to boosted points.
-
#start ⇒ String
readonly
The start date of the points boost (YYYY-MM-DD).
-
#status ⇒ TrophyApiClient::PointsBoostWebhookPayloadStatus
readonly
The status of the points boost.
-
#user_id ⇒ String
readonly
The customer-facing user ID that the boost is scoped to, or null for global boosts.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ TrophyApiClient::PointsBoostWebhookPayload
Deserialize a JSON object to an instance of PointsBoostWebhookPayload.
-
.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(id:, name:, status:, points_system_id:, points_system_key:, points_system_name:, start:, multiplier:, rounding:, user_id: OMIT, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PointsBoostWebhookPayload constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PointsBoostWebhookPayload to a JSON object.
Constructor Details
#initialize(id:, name:, status:, points_system_id:, points_system_key:, points_system_name:, start:, multiplier:, rounding:, user_id: OMIT, end_: OMIT, additional_properties: nil) ⇒ TrophyApiClient::PointsBoostWebhookPayload
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 57 def initialize(id:, name:, status:, points_system_id:, points_system_key:, points_system_name:, start:, multiplier:, rounding:, user_id: OMIT, end_: OMIT, additional_properties: nil) @id = id @name = name @status = status @user_id = user_id if user_id != OMIT @points_system_id = points_system_id @points_system_key = points_system_key @points_system_name = points_system_name @start = start @end_ = end_ if end_ != OMIT @multiplier = multiplier @rounding = rounding @additional_properties = additional_properties @_field_set = { "id": id, "name": name, "status": status, "userId": user_id, "pointsSystemId": points_system_id, "pointsSystemKey": points_system_key, "pointsSystemName": points_system_name, "start": start, "end": end_, "multiplier": multiplier, "rounding": rounding }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
36 37 38 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 36 def additional_properties @additional_properties end |
#end_ ⇒ String (readonly)
Returns The end date of the points boost (YYYY-MM-DD), or null if open-ended.
30 31 32 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 30 def end_ @end_ end |
#id ⇒ String (readonly)
Returns The ID of the points boost.
13 14 15 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 13 def id @id end |
#multiplier ⇒ Float (readonly)
Returns The multiplier applied to points during the boost.
32 33 34 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 32 def multiplier @multiplier end |
#name ⇒ String (readonly)
Returns The name of the points boost.
15 16 17 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 15 def name @name end |
#points_system_id ⇒ String (readonly)
Returns The ID of the points system this boost applies to.
22 23 24 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 22 def points_system_id @points_system_id end |
#points_system_key ⇒ String (readonly)
Returns The key of the points system this boost applies to.
24 25 26 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 24 def points_system_key @points_system_key end |
#points_system_name ⇒ String (readonly)
Returns The name of the points system this boost applies to.
26 27 28 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 26 def points_system_name @points_system_name end |
#rounding ⇒ TrophyApiClient::PointsBoostWebhookPayloadRounding (readonly)
Returns The rounding method applied to boosted points.
34 35 36 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 34 def rounding @rounding end |
#start ⇒ String (readonly)
Returns The start date of the points boost (YYYY-MM-DD).
28 29 30 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 28 def start @start end |
#status ⇒ TrophyApiClient::PointsBoostWebhookPayloadStatus (readonly)
Returns The status of the points boost.
17 18 19 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 17 def status @status end |
#user_id ⇒ String (readonly)
Returns The customer-facing user ID that the boost is scoped to, or null for global boosts.
20 21 22 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 20 def user_id @user_id end |
Class Method Details
.from_json(json_object:) ⇒ TrophyApiClient::PointsBoostWebhookPayload
Deserialize a JSON object to an instance of PointsBoostWebhookPayload
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 92 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"] status = parsed_json["status"] user_id = parsed_json["userId"] points_system_id = parsed_json["pointsSystemId"] points_system_key = parsed_json["pointsSystemKey"] points_system_name = parsed_json["pointsSystemName"] start = parsed_json["start"] end_ = parsed_json["end"] multiplier = parsed_json["multiplier"] rounding = parsed_json["rounding"] new( id: id, name: name, status: status, user_id: user_id, points_system_id: points_system_id, points_system_key: points_system_key, points_system_name: points_system_name, start: start, end_: end_, multiplier: multiplier, rounding: rounding, 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.
135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 135 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.status.is_a?(TrophyApiClient::PointsBoostWebhookPayloadStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.user_id&.is_a?(String) != false || raise("Passed value for field obj.user_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.points_system_key.is_a?(String) != false || raise("Passed value for field obj.points_system_key is not the expected type, validation failed.") obj.points_system_name.is_a?(String) != false || raise("Passed value for field obj.points_system_name 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.multiplier.is_a?(Float) != false || raise("Passed value for field obj.multiplier is not the expected type, validation failed.") obj.rounding.is_a?(TrophyApiClient::PointsBoostWebhookPayloadRounding) != false || raise("Passed value for field obj.rounding is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PointsBoostWebhookPayload to a JSON object
125 126 127 |
# File 'lib/trophy_api_client/types/points_boost_webhook_payload.rb', line 125 def to_json(*_args) @_field_set&.to_json end |