Class: TmdbApiClient::ListDetailsResponseCreatedBy

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(avatar_path: OMIT, gravatar_hash: OMIT, id: OMIT, name: OMIT, username: OMIT, additional_properties: nil) ⇒ TmdbApiClient::ListDetailsResponseCreatedBy



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tmdb_ryanstep/types/list_details_response_created_by.rb', line 33

def initialize(avatar_path: OMIT, gravatar_hash: OMIT, id: OMIT, name: OMIT, username: OMIT,
               additional_properties: nil)
  @avatar_path = avatar_path if avatar_path != OMIT
  @gravatar_hash = gravatar_hash if gravatar_hash != OMIT
  @id = id if id != OMIT
  @name = name if name != OMIT
  @username = username if username != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "avatar_path": avatar_path,
    "gravatar_hash": gravatar_hash,
    "id": id,
    "name": name,
    "username": username
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)



19
20
21
# File 'lib/tmdb_ryanstep/types/list_details_response_created_by.rb', line 19

def additional_properties
  @additional_properties
end

#avatar_path ⇒ String (readonly)



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

def avatar_path
  @avatar_path
end

#gravatar_hash ⇒ String (readonly)



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

def gravatar_hash
  @gravatar_hash
end

#id ⇒ String (readonly)



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

def id
  @id
end

#name ⇒ String (readonly)



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

def name
  @name
end

#username ⇒ String (readonly)



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

def username
  @username
end

Class Method Details

.from_json(json_object:) ⇒ TmdbApiClient::ListDetailsResponseCreatedBy

Deserialize a JSON object to an instance of ListDetailsResponseCreatedBy



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/tmdb_ryanstep/types/list_details_response_created_by.rb', line 56

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



87
88
89
90
91
92
93
# File 'lib/tmdb_ryanstep/types/list_details_response_created_by.rb', line 87

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ListDetailsResponseCreatedBy to a JSON object



77
78
79
# File 'lib/tmdb_ryanstep/types/list_details_response_created_by.rb', line 77

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