Class: TrophyApiClient::BulkInsertIssue

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

Overview

An issue encountered while bulk inserting data.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_id:, level:, reason:, additional_properties: nil) ⇒ TrophyApiClient::BulkInsertIssue



29
30
31
32
33
34
35
# File 'lib/trophy_api_client/types/bulk_insert_issue.rb', line 29

def initialize(user_id:, level:, reason:, additional_properties: nil)
  @user_id = user_id
  @level = level
  @reason = reason
  @additional_properties = additional_properties
  @_field_set = { "userId": user_id, "level": level, "reason": reason }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#levelTrophyApiClient::BulkInsertIssueLevel (readonly)



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

def level
  @level
end

#reasonString (readonly)



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

def reason
  @reason
end

#user_idString (readonly)



11
12
13
# File 'lib/trophy_api_client/types/bulk_insert_issue.rb', line 11

def user_id
  @user_id
end

Class Method Details

.from_json(json_object:) ⇒ TrophyApiClient::BulkInsertIssue

Deserialize a JSON object to an instance of BulkInsertIssue



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  user_id = parsed_json["userId"]
  level = parsed_json["level"]
  reason = parsed_json["reason"]
  new(
    user_id: user_id,
    level: level,
    reason: reason,
    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.


68
69
70
71
72
# File 'lib/trophy_api_client/types/bulk_insert_issue.rb', line 68

def self.validate_raw(obj:)
  obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
  obj.level.is_a?(TrophyApiClient::BulkInsertIssueLevel) != false || raise("Passed value for field obj.level is not the expected type, validation failed.")
  obj.reason.is_a?(String) != false || raise("Passed value for field obj.reason is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of BulkInsertIssue to a JSON object



58
59
60
# File 'lib/trophy_api_client/types/bulk_insert_issue.rb', line 58

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