Class: Spaceship::ConnectAPI::Provisioning::Client
- Inherits:
-
APIClient
- Object
- Spaceship::Client
- APIClient
- Spaceship::ConnectAPI::Provisioning::Client
- Defined in:
- spaceship/lib/spaceship/connect_api/provisioning/client.rb
Constant Summary
Constants inherited from Spaceship::Client
Spaceship::Client::AUTH_TYPES, Spaceship::Client::AccessForbiddenError, Spaceship::Client::AppleTimeoutError, Spaceship::Client::BadGatewayError, Spaceship::Client::BasicPreferredInfoError, Spaceship::Client::GatewayTimeoutError, Spaceship::Client::InsufficientPermissions, Spaceship::Client::InternalServerError, Spaceship::Client::InvalidUserCredentialsError, Spaceship::Client::NoUserCredentialsError, Spaceship::Client::PROTOCOL_VERSION, Spaceship::Client::ProgramLicenseAgreementUpdated, Spaceship::Client::TooManyRequestsError, Spaceship::Client::USER_AGENT, Spaceship::Client::UnauthorizedAccessError, Spaceship::Client::UnexpectedResponse
Instance Attribute Summary
Attributes inherited from APIClient
Attributes inherited from Spaceship::Client
#additional_headers, #client, #csrf_tokens, #logger, #provider, #user, #user_email
Class Method Summary collapse
Instance Method Summary collapse
- #delete(url_or_path, params = nil) ⇒ Object
-
#get(url_or_path, params = nil) ⇒ Object
Helpers.
-
#initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil) ⇒ Client
constructor
A new instance of Client.
- #post(url_or_path, body) ⇒ Object
- #proxy_delete(url_or_path, params = nil) ⇒ Object
- #proxy_get(url_or_path, params = nil) ⇒ Object
- #proxy_post(url_or_path, body) ⇒ Object
Methods inherited from APIClient
#build_params, #hostname, #patch, #web_session?
Methods inherited from Spaceship::Client
#UI, #ask_for_2fa_code, #choose_phone_number, client_with_authorization_from, #cookie, #detect_most_common_errors_and_raise_exceptions, #exit_with_session_state, #fastlane_user_dir, #fetch_hashcash, #fetch_olympus_session, #fetch_program_license_agreement_messages, #handle_two_factor, #handle_two_step, #handle_two_step_for_device, #handle_two_step_or_factor, #has_valid_session, #itc_service_key, #load_session_from_env, #load_session_from_file, login, #login, #match_phone_to_masked_phone, #page_size, #paging, #parse_response, #persistent_cookie_path, #phone_id_from_masked_number, #phone_id_from_number, #push_mode_from_masked_number, #push_mode_from_number, #raise_insufficient_permission_error!, #request, #request_two_factor_code_from_phone, #request_two_factor_code_from_phone_choose, #send_shared_login_request, #sms_automatically_sent, #sms_fallback, spaceship_session_env, #store_cookie, #store_session, #team_id, #team_id=, #team_information, #team_name, #teams, #try_upgrade_2fa_later, #update_request_headers, #user_details_data, #with_retry
Constructor Details
#initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 9 def initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil) another_client ||= Spaceship::Portal.client if .nil? && token.nil? super(cookie: , current_team_id: current_team_id, token: token, another_client: another_client) self.extend(Spaceship::ConnectAPI::Provisioning::API) self.provisioning_request_client = self end |
Class Method Details
.hostname ⇒ Object
18 19 20 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 18 def self.hostname 'https://developer.apple.com/services-account/' end |
Instance Method Details
#delete(url_or_path, params = nil) ⇒ Object
42 43 44 45 46 47 48 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 42 def delete(url_or_path, params = nil) # The Provisioning App Store Connect API needs to be proxied through a # POST request if using web session return proxy_delete(url_or_path, params) if web_session? super(url_or_path, params) end |
#get(url_or_path, params = nil) ⇒ Object
Helpers
26 27 28 29 30 31 32 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 26 def get(url_or_path, params = nil) # The Provisioning App Store Connect API needs to be proxied through a # POST request if using web session return proxy_get(url_or_path, params) if web_session? super(url_or_path, params) end |
#post(url_or_path, body) ⇒ Object
34 35 36 37 38 39 40 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 34 def post(url_or_path, body) # The Provisioning App Store Connect API needs teamId added to the body of # each post if using web session return proxy_post(url_or_path, body) if web_session? super(url_or_path, body) end |
#proxy_delete(url_or_path, params = nil) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 76 def proxy_delete(url_or_path, params = nil) encoded_params = Faraday::NestedParamsEncoder.encode(params) body = { "urlEncodedQueryParams" => encoded_params, "teamId" => team_id } response = request(:post) do |req| req.url(url_or_path) req.body = body.to_json req.headers['Content-Type'] = 'application/vnd.api+json' req.headers['X-HTTP-Method-Override'] = 'DELETE' req.headers['X-Requested-With'] = 'XMLHttpRequest' end handle_response(response) end |
#proxy_get(url_or_path, params = nil) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 50 def proxy_get(url_or_path, params = nil) encoded_params = Faraday::NestedParamsEncoder.encode(params) body = { "urlEncodedQueryParams" => encoded_params, "teamId" => team_id } response = request(:post) do |req| req.url(url_or_path) req.body = body.to_json req.headers['Content-Type'] = 'application/vnd.api+json' req.headers['X-HTTP-Method-Override'] = 'GET' req.headers['X-Requested-With'] = 'XMLHttpRequest' end handle_response(response) end |
#proxy_post(url_or_path, body) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'spaceship/lib/spaceship/connect_api/provisioning/client.rb', line 64 def proxy_post(url_or_path, body) body[:data][:attributes][:teamId] = team_id response = request(:post) do |req| req.url(url_or_path) req.body = body.to_json req.headers['Content-Type'] = 'application/vnd.api+json' req.headers['X-Requested-With'] = 'XMLHttpRequest' end handle_response(response) end |