Class: TmdbApiClient::ListCreateResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/tmdb_ryanstep/types/list_create_response.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_message: OMIT, id: OMIT, success: OMIT, status_code: OMIT, additional_properties: nil) ⇒ TmdbApiClient::ListCreateResponse

Parameters:

  • status_message (String) (defaults to: OMIT)
  • id (Integer) (defaults to: OMIT)
  • success (Boolean) (defaults to: OMIT)
  • status_code (Integer) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 30

def initialize(status_message: OMIT, id: OMIT, success: OMIT, status_code: OMIT, additional_properties: nil)
  @status_message = status_message if status_message != OMIT
  @id = id if id != OMIT
  @success = success if success != OMIT
  @status_code = status_code if status_code != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "status_message": status_message,
    "id": id,
    "success": success,
    "status_code": status_code
  }.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



17
18
19
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 17

def additional_properties
  @additional_properties
end

#idInteger (readonly)

Returns:

  • (Integer)


11
12
13
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 11

def id
  @id
end

#status_codeInteger (readonly)

Returns:

  • (Integer)


15
16
17
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 15

def status_code
  @status_code
end

#status_messageString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 9

def status_message
  @status_message
end

#successBoolean (readonly)

Returns:

  • (Boolean)


13
14
15
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 13

def success
  @success
end

Class Method Details

.from_json(json_object:) ⇒ TmdbApiClient::ListCreateResponse

Deserialize a JSON object to an instance of ListCreateResponse

Parameters:

  • json_object (String)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 50

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  status_message = parsed_json["status_message"]
  id = parsed_json["id"]
  success = parsed_json["success"]
  status_code = parsed_json["status_code"]
  new(
    status_message: status_message,
    id: id,
    success: success,
    status_code: status_code,
    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)


79
80
81
82
83
84
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 79

def self.validate_raw(obj:)
  obj.status_message&.is_a?(String) != false || raise("Passed value for field obj.status_message 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.success&.is_a?(Boolean) != false || raise("Passed value for field obj.success is not the expected type, validation failed.")
  obj.status_code&.is_a?(Integer) != false || raise("Passed value for field obj.status_code is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ListCreateResponse to a JSON object

Returns:

  • (String)


69
70
71
# File 'lib/tmdb_ryanstep/types/list_create_response.rb', line 69

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