Class: NewDemoApiClient::CreateFileResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/create_file_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, id:, type: OMIT, created_at: OMIT, updated_at: OMIT, is_archived: OMIT, deal_id: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::CreateFileResponse

Parameters:

  • name (String)
  • type (NewDemoApiClient::FileType) (defaults to: OMIT)

    The type of the file

  • id (Integer)
  • created_at (DateTime) (defaults to: OMIT)
  • updated_at (DateTime) (defaults to: OMIT)
  • is_archived (Boolean) (defaults to: OMIT)
  • deal_id (Integer) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/test_sdk/types/create_file_response.rb', line 41

def initialize(name:, id:, type: OMIT, created_at: OMIT, updated_at: OMIT, is_archived: OMIT, deal_id: OMIT,
               additional_properties: nil)
  @name = name
  @type = type if type != OMIT
  @id = id
  @created_at = created_at if created_at != OMIT
  @updated_at = updated_at if updated_at != OMIT
  @is_archived = is_archived if is_archived != OMIT
  @deal_id = deal_id if deal_id != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "type": type,
    "id": id,
    "created_at": created_at,
    "updated_at": updated_at,
    "is_archived": is_archived,
    "deal_id": deal_id
  }.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



25
26
27
# File 'lib/test_sdk/types/create_file_response.rb', line 25

def additional_properties
  @additional_properties
end

#created_atDateTime (readonly)

Returns:

  • (DateTime)


17
18
19
# File 'lib/test_sdk/types/create_file_response.rb', line 17

def created_at
  @created_at
end

#deal_idInteger (readonly)

Returns:

  • (Integer)


23
24
25
# File 'lib/test_sdk/types/create_file_response.rb', line 23

def deal_id
  @deal_id
end

#idInteger (readonly)

Returns:

  • (Integer)


15
16
17
# File 'lib/test_sdk/types/create_file_response.rb', line 15

def id
  @id
end

#is_archivedBoolean (readonly)

Returns:

  • (Boolean)


21
22
23
# File 'lib/test_sdk/types/create_file_response.rb', line 21

def is_archived
  @is_archived
end

#nameString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/test_sdk/types/create_file_response.rb', line 11

def name
  @name
end

#typeNewDemoApiClient::FileType (readonly)

Returns The type of the file.

Returns:



13
14
15
# File 'lib/test_sdk/types/create_file_response.rb', line 13

def type
  @type
end

#updated_atDateTime (readonly)

Returns:

  • (DateTime)


19
20
21
# File 'lib/test_sdk/types/create_file_response.rb', line 19

def updated_at
  @updated_at
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::CreateFileResponse

Deserialize a JSON object to an instance of CreateFileResponse

Parameters:

  • json_object (String)

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/test_sdk/types/create_file_response.rb', line 68

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  type = parsed_json["type"]
  id = parsed_json["id"]
  created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?)
  updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
  is_archived = parsed_json["is_archived"]
  deal_id = parsed_json["deal_id"]
  new(
    name: name,
    type: type,
    id: id,
    created_at: created_at,
    updated_at: updated_at,
    is_archived: is_archived,
    deal_id: deal_id,
    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)


103
104
105
106
107
108
109
110
111
# File 'lib/test_sdk/types/create_file_response.rb', line 103

def self.validate_raw(obj:)
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.type&.is_a?(NewDemoApiClient::FileType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
  obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.updated_at&.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
  obj.is_archived&.is_a?(Boolean) != false || raise("Passed value for field obj.is_archived is not the expected type, validation failed.")
  obj.deal_id&.is_a?(Integer) != false || raise("Passed value for field obj.deal_id is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateFileResponse to a JSON object

Returns:

  • (String)


93
94
95
# File 'lib/test_sdk/types/create_file_response.rb', line 93

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