Class: ConnectorKit::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/connector_kit.rb

Overview

Class used for communicating with the App Store Connect API

Instance Method Summary collapse

Constructor Details

#initialize(issuer_id, key_id, private_key_file_path) ⇒ Client

Returns a new instance of Client.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/connector_kit.rb', line 12

def initialize(issuer_id, key_id, private_key_file_path)
  token_generator = TokenGenerator.new(
    issuer_id,
    key_id,
    private_key_file_path
  )

  @httpclient = HTTPClient.new('https://api.appstoreconnect.apple.com/v1')
  @httpclient.class.headers(
    'Authorization' => "Bearer #{token_generator.generate_token}"
  )
end

Instance Method Details

#app_builds(app) ⇒ Object



33
34
35
# File 'lib/connector_kit.rb', line 33

def app_builds(app)
  @httpclient.get "/apps/#{app.id}/builds", BuildListResponseMapper.new
end

#appsObject



25
26
27
# File 'lib/connector_kit.rb', line 25

def apps
  @httpclient.get '/apps', AppListResponseMapper.new
end

#build_beta_details(build) ⇒ Object



37
38
39
40
41
42
# File 'lib/connector_kit.rb', line 37

def build_beta_details(build)
  @httpclient.get(
    "/buildBetaDetails/#{build.id}",
    BuildDetailsResponseMapper.new
  )
end

#usersObject



29
30
31
# File 'lib/connector_kit.rb', line 29

def users
  @httpclient.get '/users', UserListResponseMapper.new
end