app_store_connect 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aeae041a61a23185c40c3a84b812c29cf5f9c2b4204c0feb4a86d1a9aba1d26a
4
- data.tar.gz: 1120543dcb20ec83bd4247cacdafc482a1e454870bcef7fad5cb8b5fc856fc1c
3
+ metadata.gz: d0cd886dbe9db8dc3a9cd5733faafb369de167660b7451d6e945db4da4c41da4
4
+ data.tar.gz: 1d00be34dfc11efce5c31365665ccef95969c0316e0166347292e5265fea55d7
5
5
  SHA512:
6
- metadata.gz: 874698aa4b3252754cc4e0158c1c7ff07a12645ed073a2e7b77fb37d88dbcd28b3b337e6914fa49653987d3c4b386bd005bbf5f59603bcada0888a061138e8c4
7
- data.tar.gz: 2a864455c1835eff218490cc0d7747ad032415a796b85a7f75090dcab8e537dd6dd44a83df28d0a4f572bb171ef162b6ada6b146086fa5b753d1f4390901e5f8
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
- httparty
6
- jwt
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/app/store/connect`. To experiment with that code, run `bin/console` for an interactive prompt.
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: Write usage instructions here
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/[USERNAME]/app_store_connect.
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
 
@@ -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
- # spec.homepage = "TODO: Put your gem's website or public repo URL here."
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"
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'app_store_connect'
4
4
 
5
- puts "Hello world"
5
+ AppStoreConnect::CLI.run(ARGV)
@@ -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
- @key_id = key_id
7
- @issuer_id = issuer_id
8
- @private_key_path = private_key_path
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
@@ -1,3 +1,3 @@
1
1
  module AppStoreConnect
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,7 +1,10 @@
1
1
  require "jwt"
2
2
  require "httparty"
3
3
 
4
+ require "app_store_connect/authorization"
4
5
  require "app_store_connect/client"
6
+ require "app_store_connect/cli"
7
+ require "app_store_connect/version"
5
8
 
6
9
  module AppStoreConnect
7
10
  end
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.1.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-03-01 00:00:00.000000000 Z
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: '0'
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: '0'
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: {}