Class: Integrations::AppleAppStore
Constant Summary
collapse
- ISSUER_ID_REGEX =
/\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/
- KEY_ID_REGEX =
/\A(?=.*[A-Z])(?=.*[0-9])[A-Z0-9]+\z/
- IS_KEY_CONTENT_BASE64 =
"true"
- SECTION_TYPE_APPLE_APP_STORE =
'apple_app_store'
Constants inherited
from Integration
Integration::BASE_CLASSES, Integration::DEV_INTEGRATION_NAMES, Integration::INTEGRATION_NAMES, Integration::PROJECT_SPECIFIC_INTEGRATION_NAMES, Integration::SECTION_TYPE_CONFIGURATION, Integration::SECTION_TYPE_CONNECTION, Integration::SECTION_TYPE_TRIGGER, Integration::SNOWPLOW_EVENT_ACTION, Integration::SNOWPLOW_EVENT_LABEL, Integration::UnknownType
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Attribute Summary
Attributes included from Importable
#imported, #importing
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Integration
#activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, available_integration_names, available_integration_types, boolean_accessor, build_from_integration, #category, #chat?, #ci?, #configurable_events, create_from_active_default_integrations, default_integration, default_test_event, #default_test_event, dev_integration_names, #dup, #editable?, #event_channel_names, event_description, event_names, #event_names, #execute, field, #fields, fields, find_or_initialize_all_non_project_specific, find_or_initialize_non_project_specific_integration, #form_fields, #group_level?, #inheritable?, inherited_descendants_from_self_or_ancestors_from, instance_exists_for?, #instance_level?, integration_name_to_model, integration_name_to_type, integration_names, #json_fields, #operating?, #parent, #project_level?, project_specific_integration_names, prop_accessor, #properties=, #reencrypt_properties, #reset_updated_properties, #secret_fields, #show_active_box?, #supported_events, #supports_data_fields?, #testable?, #to_database_hash, #to_param, #updated_properties
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
#exposing_secrets_fields
Methods included from Loggable
#build_message, #log_error, #log_exception, #log_info, #logger
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
#serializable_hash
Class Method Details
.supported_events ⇒ Object
72
73
74
|
# File 'app/models/integrations/apple_app_store.rb', line 72
def self.supported_events
[]
end
|
.to_param ⇒ Object
68
69
70
|
# File 'app/models/integrations/apple_app_store.rb', line 68
def self.to_param
'apple_app_store'
end
|
Instance Method Details
#ci_variables(protected_ref:) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'app/models/integrations/apple_app_store.rb', line 95
def ci_variables(protected_ref:)
return [] unless activated?
return [] if app_store_protected_refs && !protected_ref
[
{ key: 'APP_STORE_CONNECT_API_KEY_ISSUER_ID', value: app_store_issuer_id, masked: true, public: false },
{ key: 'APP_STORE_CONNECT_API_KEY_KEY', value: Base64.encode64(app_store_private_key), masked: true,
public: false },
{ key: 'APP_STORE_CONNECT_API_KEY_KEY_ID', value: app_store_key_id, masked: true, public: false },
{ key: 'APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64', value: IS_KEY_CONTENT_BASE64, masked: false,
public: false }
]
end
|
#description ⇒ Object
44
45
46
|
# File 'app/models/integrations/apple_app_store.rb', line 44
def description
s_('AppleAppStore|Use GitLab to build and release an app in the Apple App Store.')
end
|
#help ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/models/integrations/apple_app_store.rb', line 48
def help
variable_list = [
'<code>APP_STORE_CONNECT_API_KEY_ISSUER_ID</code>',
'<code>APP_STORE_CONNECT_API_KEY_KEY_ID</code>',
'<code>APP_STORE_CONNECT_API_KEY_KEY</code>',
'<code>APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64</code>'
]
texts = [
s_("Use the Apple App Store Connect integration to easily connect to the Apple App Store with Fastlane in CI/CD pipelines."),
s_("After the Apple App Store Connect integration is activated, the following protected variables will be created for CI/CD use."),
variable_list.join('<br>'),
s_(format("To get started, see the <a href='%{url}' target='_blank'>integration documentation</a> for instructions on how to generate App Store Connect credentials, and how to use this integration.", url: Rails.application.routes.url_helpers.help_page_url('user/project/integrations/apple_app_store'))).html_safe
]
texts.join('<br><br>'.html_safe)
end
|
#initialize_properties ⇒ Object
109
110
111
112
|
# File 'app/models/integrations/apple_app_store.rb', line 109
def initialize_properties
super
self.app_store_protected_refs = true if app_store_protected_refs.nil?
end
|
#sections ⇒ Object
76
77
78
79
80
81
82
83
84
|
# File 'app/models/integrations/apple_app_store.rb', line 76
def sections
[
{
type: SECTION_TYPE_APPLE_APP_STORE,
title: s_('Integrations|Integration details'),
description: help
}
]
end
|
#test(*_args) ⇒ Object
86
87
88
89
90
91
92
93
|
# File 'app/models/integrations/apple_app_store.rb', line 86
def test(*_args)
response = client.apps
if response.has_key?(:errors)
{ success: false, message: response[:errors].first[:title] }
else
{ success: true }
end
end
|
#title ⇒ Object
40
41
42
|
# File 'app/models/integrations/apple_app_store.rb', line 40
def title
'Apple App Store Connect'
end
|