app_store_connect_api 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 18c42bce8c654ea595d03c872a965653dcd3aedf47a19f8e0c2ae9ee9a477583
4
+ data.tar.gz: 5c6f92678af702bdc9c31a3fcf172d0f0e8425820421c3b731769d9db6f0a47a
5
+ SHA512:
6
+ metadata.gz: d8629faa617c0953832aa610a128cbeec6589a31371909ebf9c22e8a7cb5e6366eb5821b242c15a41c774870e4592c51314b65ea7d74491b89dfadacb62a753b
7
+ data.tar.gz: bee3106fcddb9cf9250f3f00b84128a055b0a9ff0e17d302d7c8cd5a025f099d453d97765d042bba1143258c752dc54cf321d955cfc15202d22b284932bfed29
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Beta Train
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # app-store-connect-api
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ task :console do
2
+ exec 'irb -r app_store_connect_api -I ./lib'
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require 'app_store_connect_api/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'app_store_connect_api'
10
+ spec.version = AppStoreConnectAPI::VERSION
11
+ spec.authors = ['Ben Kraus']
12
+ spec.email = ['hello@betatrain.io']
13
+ spec.summary = 'Ruby HTTP client for the App Store Connect API'
14
+ spec.description = 'Ruby HTTP client for the App Store Connect API'
15
+ spec.homepage = 'https://github.com/betatrain/app_store_connect_api'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.test_files = spec.files.grep('^(test|spec|features)/')
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'jwt', '~> 2.1.0'
23
+ spec.add_dependency 'httparty', '~> 0.16.3'
24
+ end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby -Ku
2
+
3
+ # App Store Connect API Ruby Client Library
4
+ #
5
+ # Allows access to the App Store Connect API using the Ruby programming language.
6
+ # This library is not affiliated with Apple, Inc. or any of its subsidiaries.
7
+ #
8
+
9
+ require 'base64'
10
+ require 'jwt'
11
+ require 'httparty'
12
+
13
+ require 'app_store_connect_api/testflight/beta_testers'
14
+
15
+ module AppStoreConnectAPI
16
+
17
+ class Client
18
+ include HTTParty
19
+ base_uri 'https://api.appstoreconnect.apple.com/v1'
20
+ headers 'Authorization' => "Bearer #{@token}"
21
+
22
+ attr_accessor :token
23
+
24
+ # Configure the client
25
+ #
26
+ # @example
27
+ # client = AppStoreConnectAPI::Client.new(issuer_id, key_id, access_key_path)
28
+ #
29
+ # @param issuer_id [String] the issuer id found under the users and access page in App Store Connect
30
+ # @param key_id [String] the key id specific to the following access key
31
+ # @param access_key_path [String] path to the access key p8 file used to generate the jwt for authentication with the api
32
+ def initialize(issuer_id, key_id, access_key_path)
33
+ raise ConfigurationError, 'issuer_id is required' if issuer_id.nil?
34
+ raise ConfigurationError, 'key_id is required' if key_id.nil?
35
+ raise ConfigurationError, 'access_key_path is required' if access_key_path.nil?
36
+
37
+ private_key = OpenSSL::PKey.read(File.read(access_key_path))
38
+ @token = JWT.encode(
39
+ {
40
+ iss: issuer_id,
41
+ exp: Time.now.to_i + 20 * 60,
42
+ aud: 'appstoreconnect-v1'
43
+ },
44
+ private_key,
45
+ 'ES256',
46
+ header_fields={
47
+ kid: key_id
48
+ }
49
+ )
50
+ end
51
+
52
+ def headers
53
+ { 'Authorization' => "Bearer #{@token}" }
54
+ end
55
+
56
+ include AppStoreConnectAPI::TestFlight::BetaTesters
57
+
58
+ end
59
+
60
+ end
@@ -0,0 +1,3 @@
1
+ module AppStoreConnectAPI
2
+ class ConfigurationError < Error; end
3
+ end
@@ -0,0 +1,17 @@
1
+ module AppStoreConnectAPI
2
+ module TestFlight
3
+ module BetaTesters
4
+
5
+ # Find and list beta testers for all apps, builds, and beta groups.
6
+ def beta_testers
7
+ self.class.get("/betaTesters", headers: self.headers)
8
+ end
9
+
10
+ # Get a specific beta tester.
11
+ def beta_tester(id)
12
+ self.class.get("/betaTesters/#{id}", headers: self.headers)
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module AppStoreConnectAPI
2
+ VERSION = '0.0.2'
3
+ end
@@ -0,0 +1,4 @@
1
+ module AppStoreConnectAPI
2
+ end
3
+
4
+ require 'app_store_connect_api/client'
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: app_store_connect_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Ben Kraus
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jwt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.16.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.16.3
41
+ description: Ruby HTTP client for the App Store Connect API
42
+ email:
43
+ - hello@betatrain.io
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - app_store_connect_api.gemspec
54
+ - lib/app_store_connect_api.rb
55
+ - lib/app_store_connect_api/client.rb
56
+ - lib/app_store_connect_api/exceptions.rb
57
+ - lib/app_store_connect_api/testflight/beta_testers.rb
58
+ - lib/app_store_connect_api/version.rb
59
+ homepage: https://github.com/betatrain/app_store_connect_api
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.7.6
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Ruby HTTP client for the App Store Connect API
83
+ test_files: []