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: AgeRating, KidsAge, KoreaAgeRating, 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

#advertisingObject

Boolean



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

def advertising
  @advertising
end

#age_assuranceObject

Returns the value of attribute age_assurance.



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

def age_assurance
  @age_assurance
end

#age_rating_override_v2Object

AgeRating



34
35
36
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 34

def age_rating_override_v2
  @age_rating_override_v2
end

#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

#contestsObject

Returns the value of attribute contests.



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

def contests
  @contests
end

#developer_age_rating_info_urlObject

URL



43
44
45
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 43

def developer_age_rating_info_url
  @developer_age_rating_info_url
end

#gamblingObject

Returns the value of attribute gambling.



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

def gambling
  @gambling
end

#gambling_and_contestsObject

Deprecated as of App Store Connect API 1.3



46
47
48
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 46

def gambling_and_contests
  @gambling_and_contests
end

#gambling_simulatedObject

Returns the value of attribute gambling_simulated.



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

def gambling_simulated
  @gambling_simulated
end

#guns_or_other_weaponsObject

Returns the value of attribute guns_or_other_weapons.



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

def guns_or_other_weapons
  @guns_or_other_weapons
end

#health_or_wellness_topicsObject

Returns the value of attribute health_or_wellness_topics.



26
27
28
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 26

def health_or_wellness_topics
  @health_or_wellness_topics
end

#horror_or_fear_themesObject

Returns the value of attribute horror_or_fear_themes.



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

def horror_or_fear_themes
  @horror_or_fear_themes
end

#kids_age_bandObject

KidsAge



40
41
42
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 40

def kids_age_band
  @kids_age_band
end

#korea_age_rating_overrideObject

KoreaAgeRating



37
38
39
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 37

def korea_age_rating_override
  @korea_age_rating_override
end

#loot_boxObject

Returns the value of attribute loot_box.



27
28
29
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 27

def loot_box
  @loot_box
end

#mature_or_suggestive_themesObject

Returns the value of attribute mature_or_suggestive_themes.



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

def mature_or_suggestive_themes
  @mature_or_suggestive_themes
end

#medical_or_treatment_informationObject

Returns the value of attribute medical_or_treatment_information.



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

def medical_or_treatment_information
  @medical_or_treatment_information
end

#messaging_and_chatObject

Returns the value of attribute messaging_and_chat.



28
29
30
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 28

def messaging_and_chat
  @messaging_and_chat
end

#parental_controlsObject

Returns the value of attribute parental_controls.



29
30
31
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 29

def parental_controls
  @parental_controls
end

#profanity_or_crude_humorObject

Returns the value of attribute profanity_or_crude_humor.



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

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.



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

def sexual_content_graphic_and_nudity
  @sexual_content_graphic_and_nudity
end

#sexual_content_or_nudityObject

Returns the value of attribute sexual_content_or_nudity.



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

def sexual_content_or_nudity
  @sexual_content_or_nudity
end

#unrestricted_web_accessObject

Returns the value of attribute unrestricted_web_access.



30
31
32
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 30

def unrestricted_web_access
  @unrestricted_web_access
end

#user_generated_contentObject

Returns the value of attribute user_generated_content.



31
32
33
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 31

def user_generated_content
  @user_generated_content
end

#violence_cartoon_or_fantasyObject

Returns the value of attribute violence_cartoon_or_fantasy.



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

def violence_cartoon_or_fantasy
  @violence_cartoon_or_fantasy
end

#violence_realisticObject

Returns the value of attribute violence_realistic.



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

def violence_realistic
  @violence_realistic
end

#violence_realistic_prolonged_graphic_or_sadisticObject

Returns the value of attribute violence_realistic_prolonged_graphic_or_sadistic.



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

def violence_realistic_prolonged_graphic_or_sadistic
  @violence_realistic_prolonged_graphic_or_sadistic
end

Class Method Details

.map_deprecation_if_possible(attributes) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 140

def self.map_deprecation_if_possible(attributes)
  attributes = attributes.dup
  messages = []
  errors = []

  value = attributes.delete('gamblingAndContests')
  return attributes, messages, errors if value.nil?

  messages << "Age Rating 'gamblingAndContests' has been deprecated and split into 'gambling' and 'contests'"

  attributes['gambling'] = value
  if value == true
    errors << "'gamblingAndContests' could not be mapped to 'contests' - 'contests' requires a value of 'NONE', 'INFREQUENT_OR_MILD', or 'FREQUENT_OR_INTENSE'"
    attributes['contests'] = value
  else
    attributes['contests'] = 'NONE'
  end

  return attributes, messages, errors
end

.map_key_from_itc(key) ⇒ Object



161
162
163
164
165
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 161

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



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 167

def self.map_value_from_itc(key, value)
  boolean_keys = [
    "advertising",
    "ageAssurance",
    "gambling",
    "gamblingAndContests",
    "healthOrWellnessTopics",
    "lootBox",
    "messagingAndChat",
    "parentalControls",
    "unrestrictedWebAccess",
    "userGeneratedContent"
  ]

  if boolean_keys.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



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

def self.type
  return "ageRatingDeclarations"
end

Instance Method Details

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

API



196
197
198
199
200
# File 'spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb', line 196

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