Class: Spaceship::ConnectAPI::AgeRatingDeclaration

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb

Defined Under Namespace

Modules: KidsAge, Rating

Constant Summary collapse

LEGACY_AGE_RATING_ITC_MAP =
{
  "CARTOON_FANTASY_VIOLENCE" => "violenceCartoonOrFantasy",
  "REALISTIC_VIOLENCE" => "violenceRealistic",
  "PROLONGED_GRAPHIC_SADISTIC_REALISTIC_VIOLENCE" => "violenceRealisticProlongedGraphicOrSadistic",
  "PROFANITY_CRUDE_HUMOR" => "profanityOrCrudeHumor",
  "MATURE_SUGGESTIVE" => "matureOrSuggestiveThemes",
  "HORROR" => "horrorOrFearThemes",
  "MEDICAL_TREATMENT_INFO" => "medicalOrTreatmentInformation",
  "ALCOHOL_TOBACCO_DRUGS" => "alcoholTobaccoOrDrugUseOrReferences",
  "GAMBLING" => "gamblingSimulated",
  "SEXUAL_CONTENT_NUDITY" => "sexualContentOrNudity",
  "GRAPHIC_SEXUAL_CONTENT_NUDITY" => "sexualContentGraphicAndNudity",
  "UNRESTRICTED_WEB_ACCESS" => "unrestrictedWebAccess",
  "GAMBLING_CONTESTS" => "gamblingAndContests"
}
LEGACY_RATING_VALUE_ITC_MAP =
{
  0 => Rating::NONE,
  1 => Rating::INFREQUENT_OR_MILD,
  2 => Rating::FREQUENT_OR_INTENSE
}
LEGACY_BOOLEAN_VALUE_ITC_MAP =
{
  0 => false,
  1 => true
}

Instance Attribute Summary collapse

Attributes included from Model

#id, #reverse_attr_map

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes

Instance Attribute Details

#alcohol_tobacco_or_drug_use_or_referencesObject

Rating



8
9
10
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 8

def alcohol_tobacco_or_drug_use_or_references
  @alcohol_tobacco_or_drug_use_or_references
end

#gambling_and_contestsObject

boolean



20
21
22
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 20

def gambling_and_contests
  @gambling_and_contests
end

#gambling_simulatedObject

Returns the value of attribute gambling_simulated.



9
10
11
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 9

def gambling_simulated
  @gambling_simulated
end

#horror_or_fear_themesObject

Returns the value of attribute horror_or_fear_themes.



13
14
15
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 13

def horror_or_fear_themes
  @horror_or_fear_themes
end

#kids_age_bandObject

KidsAge



24
25
26
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 24

def kids_age_band
  @kids_age_band
end

#mature_or_suggestive_themesObject

Returns the value of attribute mature_or_suggestive_themes.



14
15
16
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 14

def mature_or_suggestive_themes
  @mature_or_suggestive_themes
end

#medical_or_treatment_informationObject

Returns the value of attribute medical_or_treatment_information.



10
11
12
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 10

def medical_or_treatment_information
  @medical_or_treatment_information
end

#profanity_or_crude_humorObject

Returns the value of attribute profanity_or_crude_humor.



11
12
13
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 11

def profanity_or_crude_humor
  @profanity_or_crude_humor
end

#sexual_content_graphic_and_nudityObject

Returns the value of attribute sexual_content_graphic_and_nudity.



12
13
14
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 12

def sexual_content_graphic_and_nudity
  @sexual_content_graphic_and_nudity
end

#unrestricted_web_accessObject

Returns the value of attribute unrestricted_web_access.



21
22
23
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 21

def unrestricted_web_access
  @unrestricted_web_access
end

#violence_cartoon_or_fantasyObject

Returns the value of attribute violence_cartoon_or_fantasy.



15
16
17
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 15

def violence_cartoon_or_fantasy
  @violence_cartoon_or_fantasy
end

#violence_realisticObject

Returns the value of attribute violence_realistic.



17
18
19
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 17

def violence_realistic
  @violence_realistic
end

#violence_realistic_prolonged_graphic_or_sadisticObject

Returns the value of attribute violence_realistic_prolonged_graphic_or_sadistic.



16
17
18
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 16

def violence_realistic_prolonged_graphic_or_sadistic
  @violence_realistic_prolonged_graphic_or_sadistic
end

Class Method Details

.map_key_from_itc(key) ⇒ Object



86
87
88
89
90
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 86

def self.map_key_from_itc(key)
  key = key.gsub("MZGenre.", "")
  return nil if key.empty?
  LEGACY_AGE_RATING_ITC_MAP[key] || key
end

.map_value_from_itc(key, value) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 92

def self.map_value_from_itc(key, value)
  if ["gamblingAndContests", "unrestrictedWebAccess"].include?(key)
    new_value = LEGACY_BOOLEAN_VALUE_ITC_MAP[value]
    return value if new_value.nil?
    return new_value
  else
    return LEGACY_RATING_VALUE_ITC_MAP[value] || value
  end

  return value
end

.typeObject



55
56
57
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 55

def self.type
  return "ageRatingDeclarations"
end

Instance Method Details

#update(client: nil, attributes: nil) ⇒ Object

API



108
109
110
111
112
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 108

def update(client: nil, attributes: nil)
  client ||= Spaceship::ConnectAPI
  attributes = reverse_attr_mapping(attributes)
  client.patch_age_rating_declaration(age_rating_declaration_id: id, attributes: attributes)
end