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'
Base::Integration::BASE_ATTRIBUTES, Base::Integration::BASE_CLASSES, Base::Integration::DEV_INTEGRATION_NAMES, Base::Integration::INSTANCE_LEVEL_ONLY_INTEGRATION_NAMES, Base::Integration::INTEGRATION_NAMES, Base::Integration::PROJECT_AND_GROUP_LEVEL_ONLY_INTEGRATION_NAMES, Base::Integration::PROJECT_LEVEL_ONLY_INTEGRATION_NAMES, Base::Integration::SECTION_TYPE_CONFIGURATION, Base::Integration::SECTION_TYPE_CONNECTION, Base::Integration::SECTION_TYPE_TRIGGER, Base::Integration::SNOWPLOW_EVENT_ACTION, Base::Integration::SNOWPLOW_EVENT_LABEL, Base::Integration::UnknownType
ApplicationRecord::MAX_PLUCK
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary
collapse
Instance Method Summary
collapse
#activate!, #activate_disabled_reason, #activated?, #api_field_names, #async_execute, #attributes, #attribution_notice, #category, #chat?, #ci?, #configurable_events, #deactivate!, #default_test_event, #description, #dup, #editable?, #event_channel_names, #event_names, #execute, #fields, #form_fields, #group_level?, #help, #inheritable?, #instance_level?, #json_fields, #manual_activation?, #operating?, #parent, #project_level?, #reencrypt_properties, #reset_updated_properties, #secret_fields, #supported_events, #supports_data_fields?, #testable?, #title, #to_database_hash, #to_param, #toggle!, #updated_properties
#extended, extensions, #included, #method_added, #override, #prepended, #queue_verification, verify!
===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, 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
#reset_on_union_error, #reset_on_unknown_attribute_error
#serializable_hash
Class Method Details
.description ⇒ Object
54
55
56
|
# File 'app/models/integrations/apple_app_store.rb', line 54
def self.description
s_('AppleAppStore|Use GitLab to build and release an app in the Apple App Store.')
end
|
.help ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'app/models/integrations/apple_app_store.rb', line 58
def self.help
variable_list = [
ActionController::Base.helpers.content_tag(:code, 'APP_STORE_CONNECT_API_KEY_ISSUER_ID'),
ActionController::Base.helpers.content_tag(:code, 'APP_STORE_CONNECT_API_KEY_KEY_ID'),
ActionController::Base.helpers.content_tag(:code, 'APP_STORE_CONNECT_API_KEY_KEY'),
ActionController::Base.helpers.content_tag(:code, 'APP_STORE_CONNECT_API_KEY_IS_KEY_CONTENT_BASE64')
]
docs_link = ActionController::Base.helpers.link_to(
'',
Rails.application.routes.url_helpers.help_page_url('user/project/integrations/apple_app_store.md'),
target: '_blank',
rel: 'noopener noreferrer'
)
tag_pair_docs_link = tag_pair(docs_link, :link_start, :link_end)
texts = [
s_("Use this integration to connect to the Apple App Store with fastlane in CI/CD pipelines."),
s_("After you enable the integration, the following protected variables are created for CI/CD use:"),
ActionController::Base.helpers.safe_join(variable_list, ActionController::Base.helpers.tag(:br)),
safe_format(s_("For more information, see the %{link_start}documentation%{link_end}."), tag_pair_docs_link)
]
ActionController::Base.helpers.safe_join(texts, ActionController::Base.helpers.tag(:br) * 2)
end
|
.supported_events ⇒ Object
88
89
90
|
# File 'app/models/integrations/apple_app_store.rb', line 88
def self.supported_events
[]
end
|
.title ⇒ Object
50
51
52
|
# File 'app/models/integrations/apple_app_store.rb', line 50
def self.title
'Apple App Store Connect'
end
|
.to_param ⇒ Object
84
85
86
|
# File 'app/models/integrations/apple_app_store.rb', line 84
def self.to_param
'apple_app_store'
end
|
Instance Method Details
#ci_variables(protected_ref:) ⇒ Object
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'app/models/integrations/apple_app_store.rb', line 111
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
|
#initialize_properties ⇒ Object
125
126
127
128
|
# File 'app/models/integrations/apple_app_store.rb', line 125
def initialize_properties
super
self.app_store_protected_refs = true if app_store_protected_refs.nil?
end
|
#sections ⇒ Object
92
93
94
95
96
97
98
99
100
|
# File 'app/models/integrations/apple_app_store.rb', line 92
def sections
[
{
type: SECTION_TYPE_APPLE_APP_STORE,
title: s_('Integrations|Integration details'),
description: help
}
]
end
|
#test(*_args) ⇒ Object
102
103
104
105
106
107
108
109
|
# File 'app/models/integrations/apple_app_store.rb', line 102
def test(*_args)
response = client.apps
if response.has_key?(:errors)
{ success: false, message: response[:errors].first[:title] }
else
{ success: true }
end
end
|