asca 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc9b810b18682238d1c5f99d0a623e99463e9160adc17d785b9fa63212dd0f0b
4
- data.tar.gz: 0d735db64772cde9d62c447fe1e7dd60f7c19b26472b6168d75b5d05992278e7
3
+ metadata.gz: d496e61191c933bb7036dbcd8ad090c6fdada312cbe6dc79afeb5f03d1199bfb
4
+ data.tar.gz: e6dc4d154574a92f0e61416ac3a8fe4dd9639da3756f1d63bfd1282ab8e31277
5
5
  SHA512:
6
- metadata.gz: b7435d44fe5e5f51b17e5694b1e1014079b7261e646bfa4717ebf2db8a695b04151e6bab12030819325fe781b9abe8e4f75676803dca3a2a4d3f6c669a70f826
7
- data.tar.gz: 04b5f0cbe2485bf6a3f3b04253c0629ea5e3860efe02de6c1f8614e11d2642b3ed925d0ca7aee8bf642bba4740b1654b5b4f45d92ec8569537e27942b16cacac
6
+ metadata.gz: 82397db647083d9278a796875ea5bf1cd9709075009f9c185e7b36ba4c756fb07f3eef81c4689b184f429ed2fcecb0cd0a3fd23bf188287dad638b79bfaa7bd9
7
+ data.tar.gz: 4632557caa586822a4abd5fb8e146ce39549f6a68fc6db52832fd6fbdcb203835fa0db01824818875c3aed3a0f2ec8fa974f28803377e69e5aa3669ed5b541e0
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Asca
2
2
 
3
3
  [![GitHub license](https://img.shields.io/github/license/xueminghao/appstoreconnectapi)](https://github.com/xueminghao/appstoreconnectapi/blob/master/LICENSE.txt)
4
- [![npm](https://img.shields.io/npm/v/asca)](https://rubygems.org/gems/asca)
4
+ [![Gem](https://img.shields.io/gem/v/asca)](https://rubygems.org/gems/asca)
5
5
 
6
6
  An apple app store connect api wrapper based on ruby!!!
7
7
 
@@ -16,37 +16,37 @@ module Asca
16
16
  # get kid
17
17
  kid = Asca::Configuration.get_config('kid')
18
18
  if !kid
19
- puts "Before generating a jwt token, please enter your kid:"
19
+ Asca::Log.info "Before generating a jwt token, please enter your kid:"
20
20
  kid = gets.chomp
21
21
  Asca::Configuration.update_config('kid', kid)
22
22
  end
23
23
  if !kid
24
- puts "Error: no kid!"
24
+ Asca::Log.error "Error: no kid!"
25
25
  return
26
26
  end
27
27
 
28
28
  # get issuer id
29
29
  iss = Asca::Configuration.get_config('iss')
30
30
  if !iss
31
- puts "Before generating a jwt token, please enter your issuer id:"
31
+ Asca::Log.info "Before generating a jwt token, please enter your issuer id:"
32
32
  iss = gets.chomp
33
33
  Asca::Configuration.update_config('iss', iss)
34
34
  end
35
35
  if !iss
36
- puts "Error: no issuer id!"
36
+ Asca::Log.error "Error: no issuer id!"
37
37
  return
38
38
  end
39
39
 
40
40
  # get private key
41
41
  private_key = Asca::Configuration.get_config('private_key')
42
42
  if !private_key
43
- puts "Before generating a jwt token, please enter your private key path:"
43
+ Asca::Log.info "Before generating a jwt token, please enter your private key path:"
44
44
  private_key_path = gets.chomp
45
45
  private_key = File.read private_key_path
46
46
  Asca::Configuration.update_config('private_key', private_key)
47
47
  end
48
48
  if !private_key
49
- puts "Error: no private key!"
49
+ Asca::Log.error "Error: no private key!"
50
50
  return
51
51
  end
52
52
 
@@ -65,14 +65,22 @@ module Asca
65
65
  "aud": "appstoreconnect-v1"
66
66
  }
67
67
 
68
- es_key = OpenSSL::PKey::EC.new private_key
68
+ begin
69
+ es_key = OpenSSL::PKey::EC.new private_key
70
+ rescue => exception
71
+ Asca::Log.info "Invalid private key, please enter your correct private key path:"
72
+ private_key_path = gets.chomp
73
+ private_key = File.read private_key_path
74
+ Asca::Configuration.update_config('private_key', private_key)
75
+ es_key = OpenSSL::PKey::EC.new private_key
76
+ end
69
77
 
70
78
  token = JWT.encode jwt_payload, es_key, 'ES256', jwt_header
71
79
  Asca::Configuration.update_config('cache_token_time', exp)
72
80
  Asca::Configuration.update_config('cache_token', token)
73
- puts "==== New token generated ===="
74
- puts token
75
- puts "============================="
81
+ Asca::Log.info "==== New token generated ===="
82
+ Asca::Log.info token
83
+ Asca::Log.info "============================="
76
84
  return token
77
85
  end
78
86
 
@@ -1,3 +1,3 @@
1
1
  module Asca
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - xueminghao