Class: ConnectorKit::Client
- Inherits:
-
Object
- Object
- ConnectorKit::Client
- Defined in:
- lib/connector_kit.rb
Overview
Class used for communicating with the App Store Connect API
Instance Method Summary collapse
- #app(id) ⇒ Object
- #app_builds(app) ⇒ Object
- #apps ⇒ Object
- #build_beta_details(build) ⇒ Object
-
#initialize(issuer_id, key_id, private_key) ⇒ Client
constructor
A new instance of Client.
- #prepare_submission_versions(id) ⇒ Object
- #ready_sale_versions(id) ⇒ Object
- #release_version(id, state) ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(issuer_id, key_id, private_key) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/connector_kit.rb', line 15 def initialize(issuer_id, key_id, private_key) token_generator = TokenGenerator.new( issuer_id, key_id, private_key ) @httpclient = HTTPClient.new('https://api.appstoreconnect.apple.com/v1') @httpclient.class.headers( 'Authorization' => "Bearer #{token_generator.generate_token}" ) end |
Instance Method Details
#app(id) ⇒ Object
40 41 42 |
# File 'lib/connector_kit.rb', line 40 def app(id) @httpclient.get "/apps/#{id}", AppResponseMapper.new end |
#app_builds(app) ⇒ Object
36 37 38 |
# File 'lib/connector_kit.rb', line 36 def app_builds(app) @httpclient.get "/apps/#{app.id}/builds", BuildListResponseMapper.new end |
#apps ⇒ Object
28 29 30 |
# File 'lib/connector_kit.rb', line 28 def apps @httpclient.get '/apps', AppListResponseMapper.new end |
#build_beta_details(build) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/connector_kit.rb', line 56 def build_beta_details(build) @httpclient.get( "/buildBetaDetails/#{build.id}", BuildDetailsResponseMapper.new ) end |
#prepare_submission_versions(id) ⇒ Object
44 45 46 |
# File 'lib/connector_kit.rb', line 44 def prepare_submission_versions(id) releaseVersion(id, "PREPARE_FOR_SUBMISSION") end |
#ready_sale_versions(id) ⇒ Object
48 49 50 |
# File 'lib/connector_kit.rb', line 48 def ready_sale_versions(id) releaseVersion(id, "READY_FOR_SALE") end |
#release_version(id, state) ⇒ Object
52 53 54 |
# File 'lib/connector_kit.rb', line 52 def release_version(id, state) @httpclient.get "/apps/#{id}/appStoreVersions?filter[appStoreState]=#{state}", VersionResponseMapper.new end |
#users ⇒ Object
32 33 34 |
# File 'lib/connector_kit.rb', line 32 def users @httpclient.get '/users', UserListResponseMapper.new end |