app_store_connect 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -2
- data/README.md +3 -5
- data/app_store_connect.gemspec +5 -5
- data/{bin → exe}/app_store_connect +1 -1
- data/lib/app_store_connect/authorization.rb +30 -0
- data/lib/app_store_connect/cli.rb +71 -0
- data/lib/app_store_connect/client.rb +14 -23
- data/lib/app_store_connect/version.rb +1 -1
- data/lib/app_store_connect.rb +3 -0
- metadata +30 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0cd886dbe9db8dc3a9cd5733faafb369de167660b7451d6e945db4da4c41da4
|
4
|
+
data.tar.gz: 1d00be34dfc11efce5c31365665ccef95969c0316e0166347292e5265fea55d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf97714f519a150fcfea20b809e4106634d7e831c3fd0bb8d1e6e880d20bfdf03fe2652b9adf20e3070ab8bc0db4514c6a8de824c3e65ca20fc1d997673d1c20
|
7
|
+
data.tar.gz: 8aca030237418bfaa4da6165cc13c709a8483bc6318f3f1bd264815409e7c2d67ba000d1064a703b4c23f4c1d8548ffdd4d33fe355fa1db4c94f4a4121707582
|
data/Gemfile.lock
CHANGED
@@ -2,14 +2,16 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
app_store_connect (0.1.0)
|
5
|
-
|
6
|
-
|
5
|
+
gli (~> 2.17)
|
6
|
+
httparty (~> 0.16)
|
7
|
+
jwt (~> 2.1)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
12
|
coderay (1.1.2)
|
12
13
|
diff-lcs (1.3)
|
14
|
+
gli (2.17.1)
|
13
15
|
httparty (0.16.2)
|
14
16
|
multi_xml (>= 0.5.2)
|
15
17
|
jwt (2.1.0)
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# AppStoreConnect
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
TODO
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,7 +20,7 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
TODO
|
23
|
+
TODO
|
26
24
|
|
27
25
|
## Development
|
28
26
|
|
@@ -32,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
30
|
|
33
31
|
## Contributing
|
34
32
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kyledecot/app_store_connect.
|
36
34
|
|
37
35
|
## License
|
38
36
|
|
data/app_store_connect.gemspec
CHANGED
@@ -11,20 +11,20 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Write a short summary, because RubyGems requires one.}
|
13
13
|
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
-
|
14
|
+
spec.homepage = "https://github.com/kyledecot/app_store_connect"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
# Specify which files should be added to the gem when it is released.
|
18
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
17
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
18
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
19
|
end
|
20
|
+
|
22
21
|
spec.bindir = "exe"
|
23
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
23
|
spec.require_paths = ["lib"]
|
25
24
|
|
26
|
-
spec.add_runtime_dependency "httparty"
|
27
|
-
spec.add_runtime_dependency "jwt"
|
25
|
+
spec.add_runtime_dependency "httparty", "~> 0.16"
|
26
|
+
spec.add_runtime_dependency "jwt", "~> 2.1"
|
27
|
+
spec.add_runtime_dependency "gli", "~> 2.17"
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 2.0"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module AppStoreConnect
|
2
|
+
class Authorization
|
3
|
+
AUDIENCE = "appstoreconnect-v1"
|
4
|
+
|
5
|
+
def initialize(key_id:, issuer_id:, private_key_path:)
|
6
|
+
@key_id = key_id
|
7
|
+
@issuer_id = issuer_id
|
8
|
+
@private_key_path = private_key_path
|
9
|
+
end
|
10
|
+
|
11
|
+
def payload
|
12
|
+
{
|
13
|
+
exp: Time.now.to_i + 20 * 60,
|
14
|
+
iss: @issuer_id,
|
15
|
+
aud: AUDIENCE
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def token
|
20
|
+
JWT.encode(payload, private_key, "ES256", kid: @key_id)
|
21
|
+
end
|
22
|
+
|
23
|
+
def private_key
|
24
|
+
@private_key ||= begin
|
25
|
+
path = File.expand_path(@private_key_path)
|
26
|
+
OpenSSL::PKey.read(File.read(path))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require "gli"
|
2
|
+
|
3
|
+
require "app_store_connect/version"
|
4
|
+
|
5
|
+
module AppStoreConnect
|
6
|
+
class CLI
|
7
|
+
extend GLI::App
|
8
|
+
|
9
|
+
program_desc "Here is my program description"
|
10
|
+
version AppStoreConnect::VERSION
|
11
|
+
|
12
|
+
flag [:i, 'issuer-id'],
|
13
|
+
:default_value => ENV["APP_STORE_CONNECT_ISSUER_ID"]
|
14
|
+
|
15
|
+
flag [:p, 'private-key-path'],
|
16
|
+
:default_value => ENV["APP_STORE_CONNECT_PRIVATE_KEY_PATH"]
|
17
|
+
|
18
|
+
flag [:k, 'key-id'],
|
19
|
+
:default_value => ENV["APP_STORE_CONNECT_KEY_ID"]
|
20
|
+
|
21
|
+
command "app" do |c|
|
22
|
+
c.flag [:a, :app_id], :required => true
|
23
|
+
|
24
|
+
c.action do |_, options|
|
25
|
+
app_id = options[:app_id]
|
26
|
+
puts client.app(app_id).to_json
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
command "apps" do |c|
|
31
|
+
c.desc "Gets all of the apps"
|
32
|
+
c.long_desc "The long desc"
|
33
|
+
|
34
|
+
c.action do |global_options, _,_|
|
35
|
+
puts client(global_options).apps.to_json
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
command "builds" do |c|
|
40
|
+
c.flag [:a, :app_id], :required => true
|
41
|
+
|
42
|
+
c.action do |global_options, options|
|
43
|
+
app_id = options[:app_id]
|
44
|
+
|
45
|
+
puts client(global_options).builds(app_id).to_json
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
command "build" do |c|
|
50
|
+
c.flag [:a, :app_id], :required => true
|
51
|
+
c.switch [:b, :build_id], :required => true
|
52
|
+
|
53
|
+
c.action do |global_options, options|
|
54
|
+
app_id = options[:app_id]
|
55
|
+
build_id = options[:build_id]
|
56
|
+
|
57
|
+
puts client(global_options).build(app_id, build_id).to_json
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def self.client(global_options)
|
64
|
+
AppStoreConnect::Client.new(
|
65
|
+
:private_key_path => global_options[:private_key_path],
|
66
|
+
:issuer_id => global_options[:issuer_id],
|
67
|
+
:key_id => global_options[:key_id]
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -3,9 +3,11 @@ module AppStoreConnect
|
|
3
3
|
ENDPOINT = "https://api.appstoreconnect.apple.com/v1"
|
4
4
|
|
5
5
|
def initialize(key_id:, issuer_id:, private_key_path:)
|
6
|
-
@
|
7
|
-
|
8
|
-
|
6
|
+
@authorization = Authorization.new(
|
7
|
+
:private_key_path => private_key_path,
|
8
|
+
:key_id => key_id,
|
9
|
+
:issuer_id => issuer_id
|
10
|
+
)
|
9
11
|
end
|
10
12
|
|
11
13
|
def apps
|
@@ -24,6 +26,14 @@ module AppStoreConnect
|
|
24
26
|
get("apps/#{app_id}/builds/#{build_id}")
|
25
27
|
end
|
26
28
|
|
29
|
+
def users
|
30
|
+
get("users")
|
31
|
+
end
|
32
|
+
|
33
|
+
def user_invitations
|
34
|
+
get("userInvitations")
|
35
|
+
end
|
36
|
+
|
27
37
|
private
|
28
38
|
|
29
39
|
def get(path)
|
@@ -32,27 +42,8 @@ module AppStoreConnect
|
|
32
42
|
response["data"]
|
33
43
|
end
|
34
44
|
|
35
|
-
def payload
|
36
|
-
{
|
37
|
-
exp: Time.now.to_i + 20 * 60,
|
38
|
-
iss: @issuer_id,
|
39
|
-
aud: "appstoreconnect-v1"
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
def token
|
44
|
-
JWT.encode(payload, private_key, "ES256", kid: @key_id)
|
45
|
-
end
|
46
|
-
|
47
|
-
def private_key
|
48
|
-
@private_key ||= begin
|
49
|
-
path = File.expand_path(@private_key_path)
|
50
|
-
OpenSSL::PKey.read(File.read(path))
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
45
|
def headers
|
55
|
-
{ "Authorization" => "Bearer #{token}" }
|
46
|
+
{ "Authorization" => "Bearer #{@authorization.token}" }
|
56
47
|
end
|
57
48
|
end
|
58
49
|
end
|
data/lib/app_store_connect.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_store_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Decot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.16'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '0.16'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jwt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gli
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.17'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '2.17'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +111,8 @@ dependencies:
|
|
97
111
|
description:
|
98
112
|
email:
|
99
113
|
- kyle.decot@icloud.com
|
100
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- app_store_connect
|
101
116
|
extensions: []
|
102
117
|
extra_rdoc_files: []
|
103
118
|
files:
|
@@ -110,13 +125,15 @@ files:
|
|
110
125
|
- README.md
|
111
126
|
- Rakefile
|
112
127
|
- app_store_connect.gemspec
|
113
|
-
- bin/app_store_connect
|
114
128
|
- bin/console
|
115
129
|
- bin/setup
|
130
|
+
- exe/app_store_connect
|
116
131
|
- lib/app_store_connect.rb
|
132
|
+
- lib/app_store_connect/authorization.rb
|
133
|
+
- lib/app_store_connect/cli.rb
|
117
134
|
- lib/app_store_connect/client.rb
|
118
135
|
- lib/app_store_connect/version.rb
|
119
|
-
homepage:
|
136
|
+
homepage: https://github.com/kyledecot/app_store_connect
|
120
137
|
licenses:
|
121
138
|
- MIT
|
122
139
|
metadata: {}
|