Sha256: 3a3d080cd81b7f36b14bd745f9d7236ba29c6fc632cefab86d5d37f09a0288ae
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
# frozen_string_literal: true require 'active_support/all' module AppStoreConnect class Client ENDPOINT = 'https://api.appstoreconnect.apple.com/v1' def initialize(key_id:, issuer_id:, private_key:) @authorization = Authorization.new( private_key: private_key, key_id: key_id, issuer_id: issuer_id ) end def apps get('apps') end def app(id) get("apps/#{id}") end def builds(app_id) get("apps/#{app_id}/builds") end def build(app_id, build_id) get("apps/#{app_id}/builds/#{build_id}") end def invite_user(first_name:, last_name:, email:, roles:) invitation = UserInvitationCreateRequest.new(first_name, last_name, email, roles) post('userInvitations', invitation.body.to_json) end def create_bundle_id(*args) request = BundleIdCreateRequest.new(*args) post('bundleIds', body(request)) end def users(limit: 200) get('users', query_params: { 'limit' => limit }) end def user_invitations get('userInvitations') end private def body(request) request .to_hash .deep_transform_keys { |k| k.to_s.camelize(:lower) } .to_json end def get(path, query_params: {}) response = HTTParty.get("#{ENDPOINT}/#{path}", headers: headers, query: query_params) response['data'] end def post(path, body) response = HTTParty.post("#{ENDPOINT}/#{path}", headers: headers, body: body) response end def headers { 'Authorization' => "Bearer #{@authorization.token}", 'Content-Type' => 'application/json' } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
app_store_connect-0.6.0 | lib/app_store_connect/client.rb |
app_store_connect-0.5.0 | lib/app_store_connect/client.rb |
app_store_connect-0.4.0 | lib/app_store_connect/client.rb |