Class: TmdbApiClient::AccountRatedMoviesResponseResultsItemAccountRating

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at: OMIT, value: OMIT, additional_properties: nil) ⇒ TmdbApiClient::AccountRatedMoviesResponseResultsItemAccountRating

Parameters:

  • created_at (String) (defaults to: OMIT)
  • value (Integer) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



24
25
26
27
28
29
30
31
# File 'lib/tmdb_ryanstep/types/account_rated_movies_response_results_item_account_rating.rb', line 24

def initialize(created_at: OMIT, value: OMIT, additional_properties: nil)
  @created_at = created_at if created_at != OMIT
  @value = value if value != OMIT
  @additional_properties = additional_properties
  @_field_set = { "created_at": created_at, "value": value }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#created_at ⇒ String (readonly)

Returns:

  • (String)


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

def created_at
  @created_at
end

#value ⇒ Integer (readonly)

Returns:

  • (Integer)


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

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ TmdbApiClient::AccountRatedMoviesResponseResultsItemAccountRating

Deserialize a JSON object to an instance of AccountRatedMoviesResponseResultsItemAccountRating

Parameters:

  • json_object (String)

Returns:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tmdb_ryanstep/types/account_rated_movies_response_results_item_account_rating.rb', line 38

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


64
65
66
67
# File 'lib/tmdb_ryanstep/types/account_rated_movies_response_results_item_account_rating.rb', line 64

def self.validate_raw(obj:)
  obj.created_at&.is_a?(String) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
  obj.value&.is_a?(Integer) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of AccountRatedMoviesResponseResultsItemAccountRating to a JSON object

Returns:

  • (String)


54
55
56
# File 'lib/tmdb_ryanstep/types/account_rated_movies_response_results_item_account_rating.rb', line 54

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