fastlane 2.149.1 → 2.150.0.rc5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/deliver/lib/deliver.rb +0 -1
  3. data/deliver/lib/deliver/app_screenshot.rb +26 -25
  4. data/deliver/lib/deliver/download_screenshots.rb +46 -26
  5. data/deliver/lib/deliver/options.rb +6 -11
  6. data/deliver/lib/deliver/runner.rb +7 -21
  7. data/deliver/lib/deliver/setup.rb +5 -30
  8. data/deliver/lib/deliver/submit_for_review.rb +170 -86
  9. data/deliver/lib/deliver/upload_metadata.rb +355 -143
  10. data/deliver/lib/deliver/upload_price_tier.rb +22 -8
  11. data/deliver/lib/deliver/upload_screenshots.rb +140 -39
  12. data/{scan/lib/scan/.test_command_generator.rb.swp → fastlane/lib/fastlane/actions/.hockey.rb.swp} +0 -0
  13. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  14. data/{snapshot/lib/snapshot/.test_command_generator_base.rb.swp → fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp} +0 -0
  15. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  16. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +81 -96
  17. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +3 -2
  18. data/fastlane/lib/fastlane/actions/download_dsyms.rb +7 -1
  19. data/fastlane/lib/fastlane/actions/google_play_track_release_names.rb +74 -0
  20. data/fastlane/lib/fastlane/actions/set_changelog.rb +23 -20
  21. data/fastlane/lib/fastlane/actions/slack.rb +1 -1
  22. data/fastlane/lib/fastlane/actions/spm.rb +7 -0
  23. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +1 -32
  24. data/fastlane/lib/fastlane/lane.rb +3 -3
  25. data/fastlane/lib/fastlane/swift_fastlane_function.rb +8 -4
  26. data/fastlane/lib/fastlane/version.rb +1 -1
  27. data/fastlane/swift/ControlCommand.swift +1 -0
  28. data/fastlane/swift/Fastlane.swift +48 -12
  29. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  30. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/xcshareddata/xcschemes/FastlaneRunner.xcscheme +3 -9
  31. data/fastlane/swift/LaneFileProtocol.swift +2 -5
  32. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  33. data/fastlane/swift/RubyCommand.swift +29 -6
  34. data/fastlane/swift/RubyCommandable.swift +1 -0
  35. data/fastlane/swift/Runner.swift +85 -13
  36. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  37. data/fastlane/swift/SnapshotfileProtocol.swift +3 -3
  38. data/fastlane/swift/SocketClient.swift +76 -45
  39. data/fastlane/swift/SocketClientDelegateProtocol.swift +1 -1
  40. data/fastlane/swift/SocketResponse.swift +1 -0
  41. data/fastlane_core/lib/fastlane_core/build_watcher.rb +4 -4
  42. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -3
  43. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +89 -52
  44. data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +7 -0
  45. data/frameit/lib/frameit/device_types.rb +100 -100
  46. data/pilot/lib/pilot/.manager.rb.swp +0 -0
  47. data/produce/lib/produce/itunes_connect.rb +59 -21
  48. data/produce/lib/produce/options.rb +3 -3
  49. data/sigh/lib/assets/resign.sh +7 -7
  50. data/snapshot/lib/assets/SnapshotHelper.swift +5 -5
  51. data/snapshot/lib/assets/SnapshotHelperXcode8.swift +3 -3
  52. data/snapshot/lib/snapshot/options.rb +0 -1
  53. data/snapshot/lib/snapshot/reports_generator.rb +8 -1
  54. data/spaceship/lib/spaceship/client.rb +4 -3
  55. data/spaceship/lib/spaceship/connect_api.rb +25 -2
  56. data/spaceship/lib/spaceship/connect_api/.DS_Store +0 -0
  57. data/spaceship/lib/spaceship/connect_api/client.rb +97 -31
  58. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +98 -0
  59. data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
  60. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +113 -0
  61. data/spaceship/lib/spaceship/connect_api/models/app.rb +135 -3
  62. data/spaceship/lib/spaceship/connect_api/models/app_category.rb +94 -0
  63. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +67 -0
  64. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +38 -0
  65. data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +129 -0
  66. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +71 -0
  67. data/spaceship/lib/spaceship/connect_api/models/app_price.rb +22 -0
  68. data/spaceship/lib/spaceship/connect_api/models/app_price_tier.rb +12 -0
  69. data/spaceship/lib/spaceship/connect_api/models/app_review_attachment.rb +71 -0
  70. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +146 -0
  71. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +125 -0
  72. data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +51 -0
  73. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +183 -0
  74. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +86 -0
  75. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +36 -0
  76. data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +26 -0
  77. data/spaceship/lib/spaceship/connect_api/models/build.rb +4 -0
  78. data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +40 -0
  79. data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +26 -0
  80. data/spaceship/lib/spaceship/connect_api/models/territory.rb +27 -0
  81. data/spaceship/lib/spaceship/connect_api/models/user.rb +2 -1
  82. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +10 -3
  83. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +33 -0
  84. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +844 -0
  85. data/spaceship/lib/spaceship/connect_api/users/users.rb +13 -0
  86. data/spaceship/lib/spaceship/spaceauth_runner.rb +2 -2
  87. data/supply/lib/supply/client.rb +19 -0
  88. data/supply/lib/supply/reader.rb +16 -0
  89. metadata +34 -22
  90. data/deliver/lib/deliver/upload_assets.rb +0 -27
@@ -0,0 +1,98 @@
1
+ require 'faraday' # HTTP Client
2
+ require 'faraday-cookie_jar'
3
+ require 'faraday_middleware'
4
+
5
+ require 'spaceship/globals'
6
+
7
+ module Spaceship
8
+ class ConnectAPI
9
+ module FileUploader
10
+ def self.upload(upload_operations, bytes)
11
+ # {
12
+ # "method": "PUT",
13
+ # "url": "https://some-url-apple-gives-us",
14
+ # "length": 57365,
15
+ # "offset": 0,
16
+ # "requestHeaders": [
17
+ # {
18
+ # "name": "Content-Type",
19
+ # "value": "image/png"
20
+ # }
21
+ # ]
22
+ # }
23
+
24
+ upload_operations.each_with_index do |upload_operation, index|
25
+ headers = {}
26
+ upload_operation["requestHeaders"].each do |hash|
27
+ headers[hash["name"]] = hash["value"]
28
+ end
29
+
30
+ offset = upload_operation["offset"]
31
+ length = upload_operation["length"]
32
+
33
+ puts("Uploading file (part #{index + 1})...") if Spaceship::Globals.verbose?
34
+ with_retry do
35
+ client.send(
36
+ upload_operation["method"].downcase,
37
+ upload_operation["url"],
38
+ bytes[offset, length],
39
+ headers
40
+ )
41
+ end
42
+ end
43
+ puts("Uploading complete!") if Spaceship::Globals.verbose?
44
+ end
45
+
46
+ def self.with_retry(tries = 5, &_block)
47
+ tries = 1 if Object.const_defined?("SpecHelper")
48
+ response = yield
49
+
50
+ tries -= 1
51
+
52
+ unless (200...300).cover?(response.status)
53
+ msg = "Received status of #{response.status}! Retrying after 3 seconds (remaining: #{tries})..."
54
+ raise msg
55
+ end
56
+
57
+ return response
58
+ rescue => error
59
+ puts(error) if Spaceship::Globals.verbose?
60
+ if tries.zero?
61
+ raise "Failed to upload file after retries... Received #{response.status}"
62
+ else
63
+ retry
64
+ end
65
+ end
66
+
67
+ def self.client
68
+ options = {
69
+ request: {
70
+ timeout: (ENV["SPACESHIP_TIMEOUT"] || 300).to_i,
71
+ open_timeout: (ENV["SPACESHIP_TIMEOUT"] || 300).to_i
72
+ }
73
+ }
74
+
75
+ @client ||= Faraday.new(options) do |c|
76
+ c.response(:json, content_type: /\bjson$/)
77
+ c.response(:xml, content_type: /\bxml$/)
78
+ c.response(:plist, content_type: /\bplist$/)
79
+ c.adapter(Faraday.default_adapter)
80
+
81
+ if ENV['SPACESHIP_DEBUG']
82
+ # for debugging only
83
+ # This enables tracking of networking requests using Charles Web Proxy
84
+ c.proxy = "https://127.0.0.1:8888"
85
+ c.ssl[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
86
+ elsif ENV["SPACESHIP_PROXY"]
87
+ c.proxy = ENV["SPACESHIP_PROXY"]
88
+ c.ssl[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if ENV["SPACESHIP_PROXY_SSL_VERIFY_NONE"]
89
+ end
90
+
91
+ if ENV["DEBUG"]
92
+ puts("To run spaceship through a local proxy, use SPACESHIP_DEBUG")
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -15,7 +15,7 @@ module Spaceship
15
15
  end
16
16
 
17
17
  def update_attributes(attributes)
18
- attributes.each do |key, value|
18
+ (attributes || []).each do |key, value|
19
19
  method = "#{key}=".to_sym
20
20
  self.send(method, value) if self.respond_to?(method)
21
21
  end
@@ -0,0 +1,113 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AgeRatingDeclaration
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ # Rating
8
+ attr_accessor :alcohol_tobacco_or_drug_use_or_references
9
+ attr_accessor :gambling_simulated
10
+ attr_accessor :medical_or_treatment_information
11
+ attr_accessor :profanity_or_crude_humor
12
+ attr_accessor :sexual_content_graphic_and_nudity
13
+ attr_accessor :horror_or_fear_themes
14
+ attr_accessor :mature_or_suggestive_themes
15
+ attr_accessor :violence_cartoon_or_fantasy
16
+ attr_accessor :violence_realistic_prolonged_graphic_or_sadistic
17
+ attr_accessor :violence_realistic
18
+
19
+ # boolean
20
+ attr_accessor :gambling_and_contests
21
+ attr_accessor :unrestricted_web_access
22
+
23
+ # KidsAge
24
+ attr_accessor :kids_age_band
25
+
26
+ module Rating
27
+ NONE = "NONE"
28
+ INFREQUENT_OR_MILD = "INFREQUENT_OR_MILD"
29
+ FREQUENT_OR_INTENSE = "FREQUENT_OR_INTENSE"
30
+ end
31
+
32
+ module KidsAge
33
+ FIVE_AND_UNDER = "FIVE_AND_UNDER"
34
+ SIX_TO_EIGHT = "SIX_TO_EIGHT"
35
+ NINE_TO_ELEVEN = "NINE_TO_ELEVEN"
36
+ end
37
+
38
+ attr_mapping({
39
+ "alcoholTobaccoOrDrugUseOrReferences" => "alcohol_tobacco_or_drug_use_or_references",
40
+ "gamblingAndContests" => "gambling_and_contests",
41
+ "gamblingSimulated" => "gambling_simulated",
42
+ "medicalOrTreatmentInformation" => "medical_or_treatment_information",
43
+ "profanityOrCrudeHumor" => "profanity_or_crude_humor",
44
+ "sexualContentGraphicAndNudity" => "sexual_content_graphic_and_nudity",
45
+ "sexualContentOrNudity" => "sexual_content_or_nudity",
46
+ "horrorOrFearThemes" => "horror_or_fear_themes",
47
+ "matureOrSuggestiveThemes" => "mature_or_suggestive_themes",
48
+ "unrestrictedWebAccess" => "unrestricted_web_access",
49
+ "violenceCartoonOrFantasy" => "violence_cartoon_or_fantasy",
50
+ "violenceRealisticProlongedGraphicOrSadistic" => "violence_realistic_prolonged_graphic_or_sadistic",
51
+ "violenceRealistic" => "violence_realistic",
52
+ "kidsAgeBand" => "kids_age_band"
53
+ })
54
+
55
+ def self.type
56
+ return "ageRatingDeclarations"
57
+ end
58
+
59
+ LEGACY_AGE_RATING_ITC_MAP = {
60
+ "CARTOON_FANTASY_VIOLENCE" => "violenceCartoonOrFantasy",
61
+ "REALISTIC_VIOLENCE" => "violenceRealistic",
62
+ "PROLONGED_GRAPHIC_SADISTIC_REALISTIC_VIOLENCE" => "violenceRealisticProlongedGraphicOrSadistic",
63
+ "PROFANITY_CRUDE_HUMOR" => "profanityOrCrudeHumor",
64
+ "MATURE_SUGGESTIVE" => "matureOrSuggestiveThemes",
65
+ "HORROR" => "horrorOrFearThemes",
66
+ "MEDICAL_TREATMENT_INFO" => "medicalOrTreatmentInformation",
67
+ "ALCOHOL_TOBACCO_DRUGS" => "alcoholTobaccoOrDrugUseOrReferences",
68
+ "GAMBLING" => "gamblingSimulated",
69
+ "SEXUAL_CONTENT_NUDITY" => "sexualContentOrNudity",
70
+ "GRAPHIC_SEXUAL_CONTENT_NUDITY" => "sexualContentGraphicAndNudity",
71
+ "UNRESTRICTED_WEB_ACCESS" => "unrestrictedWebAccess",
72
+ "GAMBLING_CONTESTS" => "gamblingAndContests"
73
+ }
74
+
75
+ LEGACY_RATING_VALUE_ITC_MAP = {
76
+ 0 => Rating::NONE,
77
+ 1 => Rating::INFREQUENT_OR_MILD,
78
+ 2 => Rating::FREQUENT_OR_INTENSE
79
+ }
80
+
81
+ LEGACY_BOOLEAN_VALUE_ITC_MAP = {
82
+ 0 => false,
83
+ 1 => true
84
+ }
85
+
86
+ def self.map_key_from_itc(key)
87
+ key = key.gsub("MZGenre.", "")
88
+ return nil if key.empty?
89
+ LEGACY_AGE_RATING_ITC_MAP[key] || key
90
+ end
91
+
92
+ def self.map_value_from_itc(key, value)
93
+ if ["gamblingAndContests", "unrestrictedWebAccess"].include?(key)
94
+ new_value = LEGACY_BOOLEAN_VALUE_ITC_MAP[value]
95
+ return value if new_value.nil?
96
+ return new_value
97
+ else
98
+ return LEGACY_RATING_VALUE_ITC_MAP[value] || value
99
+ end
100
+
101
+ return value
102
+ end
103
+
104
+ #
105
+ # API
106
+ #
107
+
108
+ def update(attributes: nil)
109
+ Spaceship::ConnectAPI.patch_age_rating_declaration(age_rating_declaration_id: id, attributes: attributes)
110
+ end
111
+ end
112
+ end
113
+ end
@@ -13,13 +13,26 @@ module Spaceship
13
13
  attr_accessor :removed
14
14
  attr_accessor :is_aag
15
15
 
16
+ attr_accessor :content_rights_declaration
17
+
18
+ attr_accessor :app_store_versions
19
+
20
+ module ContentRightsDeclaration
21
+ USES_THIRD_PARTY_CONTENT = "USES_THIRD_PARTY_CONTENT"
22
+ DOES_NOT_USE_THIRD_PARTY_CONTENT = "DOES_NOT_USE_THIRD_PARTY_CONTENT"
23
+ end
24
+
16
25
  self.attr_mapping({
17
26
  "name" => "name",
18
27
  "bundleId" => "bundle_id",
19
28
  "sku" => "sku",
20
29
  "primaryLocale" => "primary_locale",
21
30
  "removed" => "removed",
22
- "isAAG" => "is_aag"
31
+ "isAAG" => "is_aag",
32
+
33
+ "contentRightsDeclaration" => "content_rights_declaration",
34
+
35
+ "appStoreVersions" => "app_store_versions"
23
36
  })
24
37
 
25
38
  def self.type
@@ -30,7 +43,7 @@ module Spaceship
30
43
  # Apps
31
44
  #
32
45
 
33
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
46
+ def self.all(filter: {}, includes: "appStoreVersions", limit: nil, sort: nil)
34
47
  resps = Spaceship::ConnectAPI.get_apps(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
35
48
  return resps.flat_map(&:to_models)
36
49
  end
@@ -41,12 +54,121 @@ module Spaceship
41
54
  end
42
55
  end
43
56
 
44
- def self.get(app_id: nil, includes: nil)
57
+ def self.create(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil)
58
+ Spaceship::ConnectAPI.post_app(
59
+ name: name,
60
+ version_string: version_string,
61
+ sku: sku,
62
+ primary_locale: primary_locale,
63
+ bundle_id: bundle_id,
64
+ platforms: platforms,
65
+ company_name: company_name
66
+ )
67
+ end
68
+
69
+ def self.get(app_id: nil, includes: "appStoreVersions")
45
70
  return Spaceship::ConnectAPI.get_app(app_id: app_id, includes: includes).first
46
71
  end
47
72
 
73
+ def update(attributes: nil, app_price_tier_id: nil, territory_ids: nil)
74
+ return Spaceship::ConnectAPI.patch_app(app_id: id, attributes: attributes, app_price_tier_id: app_price_tier_id, territory_ids: territory_ids)
75
+ end
76
+
77
+ #
78
+ # App Info
79
+ #
80
+
81
+ def fetch_edit_app_info
82
+ states = [
83
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::PREPARE_FOR_SUBMISSION,
84
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::DEVELOPER_REJECTED,
85
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::REJECTED,
86
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::METADATA_REJECTED,
87
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::WAITING_FOR_REVIEW,
88
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::INVALID_BINARY
89
+ ]
90
+
91
+ filter = { app: id }
92
+ resp = Spaceship::ConnectAPI.get_app_infos(filter: filter)
93
+ return resp.to_models.select do |model|
94
+ states.include?(model.app_store_state)
95
+ end.first
96
+ end
97
+
98
+ #
99
+ # App Pricing
100
+ #
101
+
102
+ def fetch_app_prices(filter: {}, includes: "priceTier", limit: nil, sort: nil)
103
+ filter ||= {}
104
+ filter[:app] = id
105
+ resp = Spaceship::ConnectAPI.get_app_prices(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
106
+ return resp.to_models
107
+ end
108
+
109
+ #
110
+ # App Store Versions
111
+ #
112
+
113
+ # Will make sure the current edit_version matches the given version number
114
+ # This will either create a new version or change the version number
115
+ # from an existing version
116
+ # @return (Bool) Was something changed?
117
+ def ensure_version!(version_string, platform: nil)
118
+ app_store_version = get_edit_app_store_version(platform: platform)
119
+
120
+ if app_store_version
121
+ if version_string != app_store_version.version_string
122
+ attributes = { versionString: version_string }
123
+ app_store_version.update(attributes: attributes)
124
+ return true
125
+ end
126
+ return false
127
+ else
128
+ attributes = { versionString: version_string, platform: platform }
129
+ Spaceship::ConnectAPI.post_app_store_version(app_id: id, attributes: attributes)
130
+
131
+ return true
132
+ end
133
+ end
134
+
135
+ def get_live_app_store_version(platform: nil, includes: nil)
136
+ platform ||= Spaceship::ConnectAPI::Platform::IOS
137
+ filter = {
138
+ appStoreState: [Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_SALE].join(","),
139
+ platform: platform
140
+ }
141
+ return get_app_store_versions(filter: filter, includes: includes).first
142
+ end
143
+
144
+ def get_edit_app_store_version(platform: nil, includes: nil)
145
+ platform ||= Spaceship::ConnectAPI::Platform::IOS
146
+ filter = {
147
+ appStoreState: [
148
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PREPARE_FOR_SUBMISSION,
149
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED,
150
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::REJECTED,
151
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::METADATA_REJECTED,
152
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW,
153
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::INVALID_BINARY
154
+ ].join(","),
155
+ platform: platform
156
+ }
157
+
158
+ # Get the latest version
159
+ return get_app_store_versions(filter: filter, includes: includes)
160
+ .sort_by { |v| Gem::Version.new(v.version_string) }
161
+ .last
162
+ end
163
+
164
+ def get_app_store_versions(filter: {}, includes: nil, limit: nil, sort: nil)
165
+ resps = Spaceship::ConnectAPI.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
166
+ return resps.flat_map(&:to_models)
167
+ end
168
+
48
169
  #
49
170
  # Beta Feedback
171
+ #
50
172
 
51
173
  def get_beta_feedback(filter: {}, includes: "tester,build,screenshots", limit: nil, sort: nil)
52
174
  filter ||= {}
@@ -114,6 +236,16 @@ module Spaceship
114
236
  ).all_pages
115
237
  return resps.flat_map(&:to_models).first
116
238
  end
239
+
240
+ #
241
+ # Users
242
+ #
243
+
244
+ def add_users(user_ids: nil)
245
+ user_ids.each do |user_id|
246
+ Spaceship::ConnectAPI.add_user_visible_apps(user_id: user_id, app_ids: [id])
247
+ end
248
+ end
117
249
  end
118
250
  end
119
251
  end
@@ -0,0 +1,94 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class AppCategory
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :platforms
8
+
9
+ attr_mapping({
10
+ "platforms" => "platforms"
11
+ })
12
+
13
+ def self.type
14
+ return "appCategories"
15
+ end
16
+
17
+ LEGACY_CATEGORY_ITC_MAP = {
18
+ "Apps.Food_Drink" => "FOOD_AND_DRINK",
19
+ "Business" => "BUSINESS",
20
+ "Education" => "EDUCATION",
21
+ "SocialNetworking" => "SOCIAL_NETWORKING",
22
+ "Book" => "BOOKS",
23
+ "Sports" => "SPORTS",
24
+ "Finance" => "FINANCE",
25
+ "Reference" => "REFERENCE",
26
+ "Apps.GraphicsDesign" => "GRAPHICS_AND_DESIGN",
27
+ "Apps.DeveloperTools" => "DEVELOPER_TOOLS",
28
+ "Healthcare_Fitness" => "HEALTH_AND_FITNESS",
29
+ "Music" => "MUSIC",
30
+ "Weather" => "WEATHER",
31
+ "Travel" => "TRAVEL",
32
+ "Entertainment" => "ENTERTAINMENT",
33
+ "Stickers" => "STICKERS",
34
+ "Games" => "GAMES",
35
+ "Lifestyle" => "LIFESTYLE",
36
+ "Medical" => "MEDICAL",
37
+ "Apps.Newsstand" => "MAGAZINES_AND_NEWSPAPERS",
38
+ "Utilities" => "UTILITIES",
39
+ "Apps.Shopping" => "SHOPPING",
40
+ "Productivity" => "PRODUCTIVITY",
41
+ "News" => "NEWS",
42
+ "Photography" => "PHOTO_AND_VIDEO",
43
+ "Navigation" => "NAVIGATION"
44
+ }
45
+
46
+ LEGACY_SUBCATEGORY_ITC_MAP = {
47
+ "Apps.Stickers.Places" => "STICKERS_PLACES_AND_OBJECTS",
48
+ "Apps.Stickers.Emotions" => "STICKERS_EMOJI_AND_EXPRESSIONS",
49
+ "Apps.Stickers.BirthdaysAndCelebrations" => "STICKERS_CELEBRATIONS",
50
+ "Apps.Stickers.Celebrities" => "STICKERS_CELEBRITIES",
51
+ "Apps.Stickers.MoviesAndTV" => "STICKERS_MOVIES_AND_TV",
52
+ "Apps.Stickers.Sports" => "STICKERS_SPORTS_AND_ACTIVITIES",
53
+ "Apps.Stickers.FoodAndDrink" => "STICKERS_EATING_AND_DRINKING",
54
+ "Apps.Stickers.Characters" => "STICKERS_CHARACTERS",
55
+ "Apps.Stickers.Animals" => "STICKERS_ANIMALS",
56
+ "Apps.Stickers.Fashion" => "STICKERS_FASHION",
57
+ "Apps.Stickers.Art" => "STICKERS_ART",
58
+ "Apps.Stickers.Games" => "STICKERS_GAMING",
59
+ "Apps.Stickers.KidsAndFamily" => "STICKERS_KIDS_AND_FAMILY",
60
+ "Apps.Stickers.People" => "STICKERS_PEOPLE",
61
+ "Apps.Stickers.Music" => "STICKERS_MUSIC",
62
+
63
+ "Sports" => "GAMES_SPORTS",
64
+ "Word" => "GAMES_WORD",
65
+ "Music" => "GAMES_MUSIC",
66
+ "Adventure" => "GAMES_ADVENTURE",
67
+ "Action" => "GAMES_ACTION",
68
+ "RolePlaying" => "GAMES_ROLE_PLAYING",
69
+ "Arcade" => "GAMES_CASUAL",
70
+ "Board" => "GAMES_BOARD",
71
+ "Trivia" => "GAMES_TRIVIA",
72
+ "Card" => "GAMES_CARD",
73
+ "Puzzle" => "GAMES_PUZZLE",
74
+ "Casino" => "GAMES_CASINO",
75
+ "Strategy" => "GAMES_STRATEGY",
76
+ "Simulation" => "GAMES_SIMULATION",
77
+ "Racing" => "GAMES_RACING",
78
+ "Family" => "GAMES_FAMILY"
79
+ }
80
+
81
+ def self.map_category_from_itc(category)
82
+ category = category.gsub("MZGenre.", "")
83
+ return nil if category.empty?
84
+ LEGACY_CATEGORY_ITC_MAP[category] || category
85
+ end
86
+
87
+ def self.map_subcategory_from_itc(category)
88
+ category = category.gsub("MZGenre.", "")
89
+ return nil if category.empty?
90
+ LEGACY_SUBCATEGORY_ITC_MAP[category] || category
91
+ end
92
+ end
93
+ end
94
+ end