authing_ruby 1.0.9 → 1.1.4

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: 2ca30daef35d2aa46bcc434a75810b5fd27a8760f3324f4878dbb8d81135d035
4
- data.tar.gz: 67304453872e3e5d430b2d0fc8db63f771a12bb01bb4171590c233c156d15bde
3
+ metadata.gz: 53d6cdb77ad3c55b067f67fe25749cce6ccfec7ce806dff9cc8e645ee21d3cbf
4
+ data.tar.gz: f950ec08cd5ea8d36b516fac6118c5fee65bf22095baca57bee388615322df3b
5
5
  SHA512:
6
- metadata.gz: 7c7fdc3e2738967b81a16e147a462e8caf995b880df92fbf6b33eec8e136624d31e07e355303f10b4bd451b52c480d7cb05bfdf66a4afe0c3b264e4a35f6d7d2
7
- data.tar.gz: c4f1e42b6c5f45456f5a98084bca6c467074fe9091e19df115262c81be8d263930e672d98c2a58826e01548ff7d00ce99d81317aab144447dfe8e6248fa03aa5
6
+ metadata.gz: 3d4697fff2570f3e8d43129a35f0e0769404b223e17dbd6e403cb29aafe35227b3001ef703f6c486001b4e44457f41bf2e8bd566f6f0c88e423b52d8b5e22df2
7
+ data.tar.gz: 314074e61c1d6dfb8ff22ba441f98353aca88ad6c9d34286731569488c7a9b1a99069dc6f55563ed8847e4528a75fa9a7ebaf8e08462b573a907edb5b677bcf9
@@ -1,10 +1,15 @@
1
- # 类似于 JS SDK 里 src/lib/graphqlapi.ts 的用途
2
- # 把一些 garpqhlClient.request 封装起来,里面包含了 const query = AccessTokenDocument;
1
+ # 类似 JS SDK 里 src/lib/graphqlapi.ts 的用途,把请求进行封装
3
2
 
4
3
  # 使用示例
5
4
  # graphqlAPI = AuthingRuby::GraphQLAPI.new
6
5
  # graphqlAPI.getAccessToken(graphqlClient, variables)
7
6
 
7
+ # 一共有三个参数
8
+ # (garpqhlClient, tokenProvider = nil, variables = nil)
9
+ # garpqhlClient 是 lib/authing_ruby/common/GraphqlClient.rb
10
+ # tokenProvider 是 lib/authing_ruby/authentication/AuthenticationTokenProvider.rb
11
+ # variables 就是参数
12
+
8
13
  module AuthingRuby
9
14
  class GraphQLAPI
10
15
 
@@ -112,12 +117,18 @@ module AuthingRuby
112
117
  return _graphql_mutation_request("resetPassword", garpqhlClient, tokenProvider, variables)
113
118
  end
114
119
 
120
+ # 更新用户手机号码
121
+ def updatePhone(garpqhlClient, tokenProvider = nil, variables = nil)
122
+ return _graphql_mutation_request("updatePhone", garpqhlClient, tokenProvider, variables)
123
+ end
124
+
115
125
  def bindPhone(garpqhlClient, tokenProvider = nil, variables = nil)
116
126
  return _graphql_mutation_request("bindPhone", garpqhlClient, tokenProvider, variables)
117
127
  end
118
128
 
119
129
  # 太多同样写法的 method 了,稍微抽象一下
120
130
  # 这个负责发 mutation 的 request
131
+ # 第一个参数 gql_file_name 就是文件名
121
132
  def _graphql_mutation_request(gql_file_name, garpqhlClient, tokenProvider, variables)
122
133
  file = File.open("#{@folder_mutation}/#{gql_file_name}.gql");
123
134
  return _graphql_request(file, garpqhlClient, tokenProvider, variables)
@@ -68,11 +68,10 @@ module AuthingRuby
68
68
  }
69
69
  }
70
70
  graphqlAPI = AuthingRuby::GraphQLAPI.new
71
- res = graphqlAPI.registerByEmail(@graphqlClient, variables)
72
- json = JSON.parse(res)
73
- user = json.dig('data', 'registerByEmail')
71
+ hash = graphqlAPI.registerByEmail(@graphqlClient, variables)
72
+ user = hash.dig('data', 'registerByEmail')
74
73
  return user if user
75
- return json
74
+ return hash
76
75
  end
77
76
 
78
77
  # 使用用户名注册
@@ -96,11 +95,10 @@ module AuthingRuby
96
95
  }
97
96
  }
98
97
  graphqlAPI = AuthingRuby::GraphQLAPI.new
99
- res = graphqlAPI.registerByUsername(@graphqlClient, variables)
100
- json = JSON.parse(res)
101
- user = json.dig('data', 'registerByUsername')
98
+ hash = graphqlAPI.registerByUsername(@graphqlClient, variables)
99
+ user = hash.dig('data', 'registerByUsername')
102
100
  return user if user
103
- return json
101
+ return hash
104
102
  end
105
103
 
106
104
  # 发送短信验证码
@@ -138,14 +136,10 @@ module AuthingRuby
138
136
  }
139
137
  }
140
138
  graphqlAPI = AuthingRuby::GraphQLAPI.new
141
- res = graphqlAPI.registerByPhoneCode(@graphqlClient, variables)
142
- if res.class.name == "String"
143
- json = JSON.parse(res)
144
- user = json.dig('data', 'registerByPhoneCode')
145
- return user if user
146
- return json
147
- end
148
- return res
139
+ hash = graphqlAPI.registerByPhoneCode(@graphqlClient, variables)
140
+ user = hash.dig('data', 'registerByPhoneCode')
141
+ return user if user
142
+ return hash
149
143
  end
150
144
 
151
145
  # 使用邮箱登录
@@ -166,14 +160,13 @@ module AuthingRuby
166
160
  }
167
161
  }
168
162
  graphqlAPI = AuthingRuby::GraphQLAPI.new
169
- res = graphqlAPI.loginByEmail(@graphqlClient, variables)
170
- json = JSON.parse(res)
171
- user = json.dig('data', 'loginByEmail')
163
+ hash = graphqlAPI.loginByEmail(@graphqlClient, variables)
164
+ user = hash.dig('data', 'loginByEmail')
172
165
  if user
173
166
  setCurrentUser(user);
174
167
  return user
175
168
  end
176
- return json
169
+ return hash
177
170
  end
178
171
 
179
172
  # 使用用户名登录
@@ -194,14 +187,13 @@ module AuthingRuby
194
187
  }
195
188
  }
196
189
  graphqlAPI = AuthingRuby::GraphQLAPI.new
197
- res = graphqlAPI.loginByUsername(@graphqlClient, variables)
198
- json = JSON.parse(res)
199
- user = json.dig('data', 'loginByUsername')
190
+ hash = graphqlAPI.loginByUsername(@graphqlClient, variables)
191
+ user = hash.dig('data', 'loginByUsername')
200
192
  if user
201
193
  setCurrentUser(user);
202
194
  return user
203
195
  end
204
- return json
196
+ return hash
205
197
  end
206
198
 
207
199
  # 使用手机号验证码登录
@@ -218,14 +210,13 @@ module AuthingRuby
218
210
  }
219
211
  }
220
212
  graphqlAPI = AuthingRuby::GraphQLAPI.new
221
- res = graphqlAPI.loginByPhoneCode(@graphqlClient, variables)
222
- json = JSON.parse(res)
223
- user = json.dig('data', 'loginByPhoneCode')
213
+ hash = graphqlAPI.loginByPhoneCode(@graphqlClient, variables)
214
+ user = hash.dig('data', 'loginByPhoneCode')
224
215
  if user
225
216
  setCurrentUser(user);
226
217
  return user
227
218
  end
228
- return json
219
+ return hash
229
220
  end
230
221
 
231
222
  # 使用手机号密码登录
@@ -245,14 +236,13 @@ module AuthingRuby
245
236
  }
246
237
  }
247
238
  graphqlAPI = AuthingRuby::GraphQLAPI.new
248
- res = graphqlAPI.loginByPhonePassword(@graphqlClient, variables)
249
- json = JSON.parse(res)
250
- user = json.dig('data', 'loginByPhonePassword')
239
+ hash = graphqlAPI.loginByPhonePassword(@graphqlClient, variables)
240
+ user = hash.dig('data', 'loginByPhonePassword')
251
241
  if user
252
242
  setCurrentUser(user);
253
243
  return user
254
244
  end
255
- return json
245
+ return hash
256
246
  end
257
247
 
258
248
  # 发送邮件
@@ -265,11 +255,10 @@ module AuthingRuby
265
255
  "scene": scene,
266
256
  }
267
257
  graphqlAPI = AuthingRuby::GraphQLAPI.new
268
- res = graphqlAPI.sendEmail(@graphqlClient, variables)
269
- json = JSON.parse(res)
270
- data = json.dig('data')
258
+ hash = graphqlAPI.sendEmail(@graphqlClient, variables)
259
+ data = hash.dig('data')
271
260
  return data if data
272
- return json
261
+ return hash
273
262
  # {"sendEmail":{"message":"","code":200}}
274
263
  end
275
264
 
@@ -277,14 +266,13 @@ module AuthingRuby
277
266
  # 返回:用户信息
278
267
  def getCurrentUser()
279
268
  graphqlAPI = AuthingRuby::GraphQLAPI.new
280
- res = graphqlAPI.getCurrentUser(@graphqlClient, @tokenProvider, {})
281
- json = JSON.parse(res)
282
- user = json.dig("data", "user")
269
+ hash = graphqlAPI.getCurrentUser(@graphqlClient, @tokenProvider, {})
270
+ user = hash.dig("data", "user")
283
271
  if user
284
272
  setCurrentUser(user)
285
273
  return user
286
274
  else
287
- return json
275
+ return hash
288
276
  end
289
277
  end
290
278
 
@@ -609,9 +597,8 @@ module AuthingRuby
609
597
  "id": userId,
610
598
  "input": updates
611
599
  }
612
- res = graphqlAPI.updateUser(@graphqlClient, @tokenProvider, variables)
613
- json = JSON.parse(res)
614
- updated_user = json.dig('data', 'updateUser')
600
+ hash = graphqlAPI.updateUser(@graphqlClient, @tokenProvider, variables)
601
+ updated_user = hash.dig('data', 'updateUser')
615
602
  if updated_user
616
603
  # 如果更新成功,返回更新后的用户
617
604
  setCurrentUser(updated_user)
@@ -619,7 +606,7 @@ module AuthingRuby
619
606
  else
620
607
  # 如果更新失败,返回原结果
621
608
  # {"errors"=>[{"message"=>{"code"=>2020, "message"=>"尚未登录,无访问权限"}, "locations"=>[{"line"=>2, "column"=>3}], "path"=>["updateUser"], "extensions"=>{"code"=>"INTERNAL_SERVER_ERROR"}}], "data"=>nil}
622
- return json
609
+ return hash
623
610
  end
624
611
  end
625
612
 
@@ -661,18 +648,16 @@ module AuthingRuby
661
648
  def checkPasswordStrength(password)
662
649
  graphqlAPI = AuthingRuby::GraphQLAPI.new
663
650
  variables = { "password": password }
664
- res = graphqlAPI.checkPasswordStrength(@graphqlClient, @tokenProvider, variables)
665
- json = JSON.parse(res)
666
- return json.dig("data", "checkPasswordStrength")
651
+ hash = graphqlAPI.checkPasswordStrength(@graphqlClient, @tokenProvider, variables)
652
+ return hash.dig("data", "checkPasswordStrength")
667
653
  end
668
654
 
669
655
  # 检测 Token 登录状态
670
656
  def checkLoginStatus(token)
671
657
  graphqlAPI = AuthingRuby::GraphQLAPI.new
672
658
  variables = { "token": token }
673
- res = graphqlAPI.checkLoginStatus(@graphqlClient, @tokenProvider, variables)
674
- json = JSON.parse(res)
675
- return json.dig("data", "checkLoginStatus")
659
+ hash = graphqlAPI.checkLoginStatus(@graphqlClient, @tokenProvider, variables)
660
+ return hash.dig("data", "checkLoginStatus")
676
661
  end
677
662
 
678
663
  # 更新用户密码
@@ -685,9 +670,8 @@ module AuthingRuby
685
670
  "oldPassword": oldPasswordEncrypted,
686
671
  }
687
672
  graphqlAPI = AuthingRuby::GraphQLAPI.new
688
- res = graphqlAPI.updatePassword(@graphqlClient, @tokenProvider, variables)
689
- json = JSON.parse(res)
690
- return json.dig("data", "updatePassword")
673
+ hash = graphqlAPI.updatePassword(@graphqlClient, @tokenProvider, variables)
674
+ return hash.dig("data", "updatePassword")
691
675
  end
692
676
 
693
677
  # 绑定手机号
@@ -698,14 +682,37 @@ module AuthingRuby
698
682
  "phone": phone,
699
683
  "phoneCode": phoneCode,
700
684
  }
701
- res = graphqlAPI.bindPhone(@graphqlClient, @tokenProvider, variables)
702
- json = JSON.parse(res)
703
- user = json.dig("data", "bindPhone")
685
+ hash = graphqlAPI.bindPhone(@graphqlClient, @tokenProvider, variables)
686
+ user = hash.dig("data", "bindPhone")
704
687
  if user
705
688
  setCurrentUser(user);
706
689
  return user;
707
690
  else
708
- return json
691
+ return hash
692
+ end
693
+ end
694
+
695
+ # 更新用户手机号
696
+ # 更新用户手机号。和修改邮箱一样,默认情况下,如果用户当前已经绑定了手机号,需要同时验证原有手机号(目前账号绑定的手机号)和当前邮箱(将要绑定的手机号)。
697
+ # 也就是说,用户 A 当前绑定的手机号为 15888888888,想修改为 15899999999,那么就需要同时验证这两个手机号。
698
+ # 开发者也可以选择不开启 “验证原有手机号“ ,可以在 Authing 控制台 的 设置目录下的安全信息模块进行关闭。
699
+ # 用户首次绑定手机号请使用 bindPhone 接口。
700
+ def updatePhone(phone, phoneCode, oldPhone, oldPhoneCode)
701
+ graphqlAPI = AuthingRuby::GraphQLAPI.new
702
+ variables = {
703
+ "phone": phone,
704
+ "phoneCode": phoneCode,
705
+ }
706
+ variables['oldPhone'] = oldPhone if oldPhone
707
+ variables['oldPhoneCode'] = oldPhoneCode if oldPhoneCode
708
+
709
+ hash = graphqlAPI.updatePhone(@graphqlClient, @tokenProvider, variables)
710
+ user = hash.dig("data", "updatePhone")
711
+ if user
712
+ setCurrentUser(user)
713
+ return user
714
+ else
715
+ return hash
709
716
  end
710
717
  end
711
718
 
@@ -720,11 +727,10 @@ module AuthingRuby
720
727
  "newPassword": newPasswordEncrypted,
721
728
  }
722
729
  graphqlAPI = AuthingRuby::GraphQLAPI.new
723
- resp = graphqlAPI.resetPassword(@graphqlClient, @tokenProvider, variables)
724
- json = JSON.parse(resp)
725
- result = json.dig("data", "resetPassword") # {"message":"重置密码成功!","code":200}
730
+ hash = graphqlAPI.resetPassword(@graphqlClient, @tokenProvider, variables)
731
+ result = hash.dig("data", "resetPassword") # {"message":"重置密码成功!","code":200}
726
732
  return result if result
727
- return json
733
+ return hash
728
734
  end
729
735
 
730
736
  def generateCodeChallenge()
@@ -14,9 +14,8 @@ module AuthingRuby
14
14
  @options = options
15
15
  end
16
16
 
17
- # 发个请求
18
- # 如果成功,返回 String
19
- # 如果失败,返回 Hash
17
+ # 发请求
18
+ # 成功或失败都返回 Hash
20
19
  def request(options)
21
20
  headers = {
22
21
  'content-type': 'application/json',
@@ -42,20 +41,19 @@ module AuthingRuby
42
41
  # puts response.body.to_s
43
42
  # puts response.body.to_s.class.name # String
44
43
 
45
- json = JSON.parse(response.body.to_s)
44
+ hash = JSON.parse(response.body.to_s)
46
45
 
47
46
  # 这里的错误处理代码参照的 JS SDK (src/lib/common/GraphqlClient.ts)
48
- if json['errors'] == nil
49
- # 如果没错误,直接返回 body
50
- body_as_string = response.body.to_s
51
- return body_as_string
47
+ if hash['errors'] == nil
48
+ # 如果没错误
49
+ return hash
52
50
  else
53
51
  # 如果有错误, 最后返回这3个字段就行
54
52
  code = nil
55
53
  message = nil
56
54
  data = nil
57
55
 
58
- json['errors'].each do |e|
56
+ hash['errors'].each do |e|
59
57
  if e['message']
60
58
  message = e['message']
61
59
  code = message['code']
@@ -0,0 +1,63 @@
1
+ mutation updatePhone(
2
+ $phone: String!
3
+ $phoneCode: String!
4
+ $oldPhone: String
5
+ $oldPhoneCode: String
6
+ ) {
7
+ updatePhone(
8
+ phone: $phone
9
+ phoneCode: $phoneCode
10
+ oldPhone: $oldPhone
11
+ oldPhoneCode: $oldPhoneCode
12
+ ) {
13
+ id
14
+ arn
15
+ userPoolId
16
+ status
17
+ username
18
+ email
19
+ emailVerified
20
+ phone
21
+ phoneVerified
22
+ unionid
23
+ openid
24
+ nickname
25
+ registerSource
26
+ photo
27
+ password
28
+ oauth
29
+ token
30
+ tokenExpiredAt
31
+ loginsCount
32
+ lastLogin
33
+ lastIP
34
+ signedUp
35
+ blocked
36
+ isDeleted
37
+ device
38
+ browser
39
+ company
40
+ name
41
+ givenName
42
+ familyName
43
+ middleName
44
+ profile
45
+ preferredUsername
46
+ website
47
+ gender
48
+ birthdate
49
+ zoneinfo
50
+ locale
51
+ address
52
+ formatted
53
+ streetAddress
54
+ locality
55
+ region
56
+ postalCode
57
+ city
58
+ province
59
+ country
60
+ createdAt
61
+ updatedAt
62
+ }
63
+ }
@@ -13,7 +13,7 @@ module AuthingRuby
13
13
  @userPoolId = options.fetch(:userPoolId, nil)
14
14
  @secret = options.fetch(:secret, nil)
15
15
  @appId = options.fetch(:appId, nil)
16
- @host = options.fetch(:host, nil)
16
+ @host = options.fetch(:host, 'https://core.authing.cn')
17
17
  @accessToken = options.fetch(:accessToken, nil)
18
18
 
19
19
  if @userPoolId == nil && @appId == nil
@@ -69,9 +69,8 @@ module AuthingRuby
69
69
  secret: @options.fetch(:secret, nil),
70
70
  }
71
71
  api = AuthingRuby::GraphQLAPI.new
72
- res = api.getAccessToken(@graphqlClient, variables)
72
+ hash = api.getAccessToken(@graphqlClient, variables)
73
73
  # {"data":{"accessToken":{"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InR5cGUiOiJ1[省略]ZWE2NjE3IiwidXNlcks2lkIjoiNjA3YjBiMTVhYWIzYTgwNWY3ZWE2NjE3IiwiX2lkIjoiNjA3YjBiMTVhYWIzYTgwNWY3ZWE2NjE3IiwicGhvbmz3Mzk5M30.K7pwyvbxypeiOlYRsTIlLXY2xyk94tTd-CATQ85jYqM","exp":1620873993,"iat":1619577993}}}
74
- hash = JSON.parse(res)
75
74
  return hash.dig("data", "accessToken", "accessToken")
76
75
  end
77
76
 
@@ -81,11 +80,9 @@ module AuthingRuby
81
80
  if accessToken == nil
82
81
  raise "无法刷新 token, 因为初始化时没有传入 accessToken"
83
82
  end
84
- res = api.refreshAccessToken(@graphqlClient, {
83
+ hash = api.refreshAccessToken(@graphqlClient, {
85
84
  accessToken: accessToken
86
85
  })
87
- hash = JSON.parse(res)
88
- # puts hash
89
86
  # {"errors"=>[{"message"=>{"code"=>500, "message"=>"该 token 在黑名单中"}, "locations"=>[{"line"=>2, "column"=>5}], "path"=>["refreshAccessToken"], "extensions"=>{"code"=>"INTERNAL_SERVER_ERROR", "exception"=>{"name"=>"TokenInBlackListError"}}}], "data"=>nil}
90
87
  if hash.dig("errors")
91
88
  return hash
@@ -29,8 +29,10 @@ module AuthingRuby
29
29
  "userInfo": userInfo,
30
30
  "keepPassword": keepPassword,
31
31
  }
32
- res = graphqlAPI.createUser(@graphqlClient, @tokenProvider, variables)
33
- return res
32
+ hash = graphqlAPI.createUser(@graphqlClient, @tokenProvider, variables)
33
+ user = hash.dig("data", "createUser")
34
+ return user if user
35
+ return hash
34
36
  end
35
37
 
36
38
  # 修改用户资料
@@ -49,8 +51,10 @@ module AuthingRuby
49
51
  "id": id,
50
52
  "input": updates
51
53
  }
52
- res = graphqlAPI.updateUser(@graphqlClient, @tokenProvider, variables)
53
- return res
54
+ hash = graphqlAPI.updateUser(@graphqlClient, @tokenProvider, variables)
55
+ user = hash.dig("data", "updateUser")
56
+ return user if user
57
+ return hash
54
58
  end
55
59
 
56
60
  # 通过 ID 获取用户信息
@@ -59,8 +63,10 @@ module AuthingRuby
59
63
  variables = {
60
64
  "id": user_id,
61
65
  }
62
- res = graphqlAPI.user(@graphqlClient, @tokenProvider, variables)
63
- return res
66
+ hash = graphqlAPI.user(@graphqlClient, @tokenProvider, variables)
67
+ user = hash.dig("data", "user")
68
+ return user if user
69
+ return hash
64
70
  end
65
71
 
66
72
  # 删除用户
@@ -69,9 +75,11 @@ module AuthingRuby
69
75
  "id": user_id,
70
76
  }
71
77
  graphqlAPI = AuthingRuby::GraphQLAPI.new
72
- res = graphqlAPI.deleteUser(@graphqlClient, @tokenProvider, variables)
73
- return res
78
+ hash = graphqlAPI.deleteUser(@graphqlClient, @tokenProvider, variables)
74
79
  # {"data":{"deleteUser":{"message":"删除成功!","code":200}}}
80
+ data = hash.dig("data", "deleteUser")
81
+ return data if data
82
+ return hash
75
83
  end
76
84
 
77
85
  # 批量删除用户
@@ -80,9 +88,11 @@ module AuthingRuby
80
88
  "ids": user_ids,
81
89
  }
82
90
  graphqlAPI = AuthingRuby::GraphQLAPI.new
83
- res = graphqlAPI.deleteUsers(@graphqlClient, @tokenProvider, variables)
84
- return res
91
+ hash = graphqlAPI.deleteUsers(@graphqlClient, @tokenProvider, variables)
85
92
  # {"data":{"deleteUsers":{"message":"删除成功!","code":200}}}
93
+ data = hash.dig("data", "deleteUsers")
94
+ return data if data
95
+ return hash
86
96
  end
87
97
 
88
98
  # 获取用户列表
@@ -92,8 +102,10 @@ module AuthingRuby
92
102
  "limit": limit,
93
103
  }
94
104
  graphqlAPI = AuthingRuby::GraphQLAPI.new
95
- res = graphqlAPI.users(@graphqlClient, @tokenProvider, variables)
96
- return res
105
+ hash = graphqlAPI.users(@graphqlClient, @tokenProvider, variables)
106
+ data = hash.dig("data", "users")
107
+ return data if data
108
+ return hash
97
109
  end
98
110
 
99
111
  # TODO
@@ -116,9 +128,10 @@ module AuthingRuby
116
128
  "phone": phone,
117
129
  }
118
130
  graphqlAPI = AuthingRuby::GraphQLAPI.new
119
- res = graphqlAPI.isUserExists(@graphqlClient, @tokenProvider, variables)
120
- json = JSON.parse(res)
121
- return json.dig('data', "isUserExists")
131
+ hash = graphqlAPI.isUserExists(@graphqlClient, @tokenProvider, variables)
132
+ data = hash.dig("data", "isUserExists")
133
+ return data if data
134
+ return hash
122
135
  end
123
136
 
124
137
  # 查找用户
@@ -138,9 +151,10 @@ module AuthingRuby
138
151
  "externalId": externalId,
139
152
  }
140
153
  graphqlAPI = AuthingRuby::GraphQLAPI.new
141
- res = graphqlAPI.findUser(@graphqlClient, @tokenProvider, variables)
142
- json = JSON.parse(res)
143
- return json
154
+ hash = graphqlAPI.findUser(@graphqlClient, @tokenProvider, variables)
155
+ data = hash.dig("data", "findUser")
156
+ return data if data
157
+ return hash
144
158
  end
145
159
 
146
160
  # TODO
@@ -8,8 +8,12 @@ module Test
8
8
  end
9
9
 
10
10
  # 随机数字字符串
11
- def randomNumString(n = 6)
12
- srand.to_s.chars.last(n).join
11
+ def randomNumString(n)
12
+ result = []
13
+ n.to_i.times do
14
+ result << [0,1,2,3,4,5,6,7,8,9].sample
15
+ end
16
+ result.join
13
17
  end
14
18
  end
15
19
  end
@@ -1,8 +1,8 @@
1
- # ruby ./lib/test/mini_test/TestApplicationsManagementClient.rb
1
+ # ruby ./lib/authing_ruby/test/mini_test/TestApplicationsManagementClient.rb
2
2
 
3
3
  require "minitest/autorun"
4
4
  require "./lib/authing_ruby.rb"
5
- require "./lib/test/helper.rb"
5
+ require "./lib/authing_ruby/test/helper.rb"
6
6
  require 'dotenv'
7
7
  Dotenv.load('.env.test')
8
8
 
@@ -1,5 +1,5 @@
1
1
  # 测试内容: 用户认证模块-认证核心模块
2
- # 如何运行: ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb
2
+ # 如何运行: ruby ./lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb
3
3
 
4
4
  require "minitest/autorun" # Minitest
5
5
  require "./lib/authing_ruby.rb" # 模块主文件
@@ -21,20 +21,20 @@ class TestAuthenticationClient < Minitest::Test
21
21
  end
22
22
 
23
23
  # 测试: 手机号+验证码+密码 注册
24
+ # 需要手动测试(填验证码)
24
25
  # ruby ./lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_registerByPhoneCode
25
26
  def test_registerByPhoneCode
26
27
  phone = '13556136684'
27
28
  code = '8086'
28
29
  password = '1234567890'
29
30
  res = @authenticationClient.registerByPhoneCode(phone, code, password)
30
- puts '拿到的结果是:-----'
31
- puts res
31
+ # puts '拿到的结果是:-----'
32
+ # puts res
32
33
  # {:code=>2026, :message=>"用户已存在,请直接登录!", :data=>nil}
33
34
  # {:code=>2001, :message=>"验证码不正确!", :data=>nil}
34
35
 
35
36
  # 如果成功
36
37
  # {"id"=>"60ad0c49d6e166f9fe23ba4d", "arn"=>"arn:cn:authing:60ab26fe478f98290befefaa:user:60ad0c49d6e166f9fe23ba4d", "userPoolId"=>"60ab26fe478f98290befefaa", "status"=>"Activated", "username"=>nil, "email"=>nil, "emailVerified"=>false, "phone"=>"13556136684", "phoneVerified"=>true, "unionid"=>nil, "openid"=>nil, "nickname"=>nil, "registerSource"=>["basic:phone-code"], "photo"=>"default-user-avatar.png", "password"=>"0361a6088087f31edd172c4f6076c0e6", "oauth"=>nil, "token"=>nil, "tokenExpiredAt"=>nil, "loginsCount"=>0, "lastLogin"=>nil, "lastIP"=>nil, "signedUp"=>nil, "blocked"=>false, "isDeleted"=>false, "device"=>nil, "browser"=>nil, "company"=>nil, "name"=>nil, "givenName"=>nil, "familyName"=>nil, "middleName"=>nil, "profile"=>nil, "preferredUsername"=>nil, "website"=>nil, "gender"=>"U", "birthdate"=>nil, "zoneinfo"=>nil, "locale"=>nil, "address"=>nil, "formatted"=>nil, "streetAddress"=>nil, "locality"=>nil, "region"=>nil, "postalCode"=>nil, "city"=>nil, "province"=>nil, "country"=>nil, "createdAt"=>"2021-05-25T14:40:09+00:00", "updatedAt"=>"2021-05-25T14:40:09+00:00", "externalId"=>nil}
37
- assert(res.dig('id'), res)
38
38
  end
39
39
 
40
40
  # 测试邮箱+密码注册
@@ -138,11 +138,13 @@ class TestAuthenticationClient < Minitest::Test
138
138
  end
139
139
 
140
140
  # 测试: 修改用户资料
141
- # ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_updateProfile
141
+ # 需要手动测试(确保用户名+密码账号的确存在)
142
+ # ruby ./lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_updateProfile
142
143
  def test_updateProfile
143
144
  # 先登录
144
145
  username = 'zhengcheng123'
145
146
  password = "123456789"
147
+ @authenticationClient.registerByUsername(username, password)
146
148
  @authenticationClient.loginByUsername(username, password)
147
149
 
148
150
  # 进行第一次修改
@@ -207,10 +209,6 @@ class TestAuthenticationClient < Minitest::Test
207
209
  assert(result.dig('id') != nil, result)
208
210
  end
209
211
 
210
- # 测试: 更新用户手机号
211
- def test_updatePhone
212
- end
213
-
214
212
  # 绑定邮箱
215
213
  def test_bindEmail
216
214
  end
@@ -220,11 +218,12 @@ class TestAuthenticationClient < Minitest::Test
220
218
  end
221
219
 
222
220
  # 测试: 检测 Token 登录状态
223
- # ruby /lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_checkLoginStatus
221
+ # ruby ./lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb -n test_checkLoginStatus
224
222
  def test_checkLoginStatus
225
223
  # 第一步:先登录然后获取 token
226
224
  username = 'zhengcheng123'
227
225
  password = "123456789"
226
+ @authenticationClient.registerByUsername(username, password)
228
227
  user = @authenticationClient.loginByUsername(username, password)
229
228
  token = user.dig("token")
230
229
 
@@ -1,4 +1,4 @@
1
- # ruby ./lib/test/mini_test/TestManagementClient.rb
1
+ # ruby ./lib/authing_ruby/test/mini_test/TestManagementClient.rb
2
2
 
3
3
  require "minitest/autorun"
4
4
  require "./lib/authing_ruby.rb"
@@ -9,8 +9,8 @@ Dotenv.load('.env.test')
9
9
  class TestManagementClient < Minitest::Test
10
10
  def setup
11
11
  @options = {
12
- # host: 'https://core.authing.cn',
13
- host: 'https://core.authing.co', # 2021-5-13 他们临时使用 .co,过几天等他们恢复了 .cn 这里就改回 .cn
12
+ host: 'https://core.authing.cn',
13
+ # host: 'https://core.authing.co', # 2021-5-13 他们临时使用 .co,过几天等他们恢复了 .cn 这里就改回 .cn
14
14
  userPoolId: ENV["userPoolId"],
15
15
  secret: ENV["secret"],
16
16
  }
@@ -18,24 +18,25 @@ class TestManagementClient < Minitest::Test
18
18
  end
19
19
 
20
20
  # 创建用户
21
- # ruby ./lib/test/mini_test/TestManagementClient.rb -n test_users_create
21
+ # ruby ./lib/authing_ruby/test/mini_test/TestManagementClient.rb -n test_users_create
22
22
  def test_users_create
23
23
  managementClient = AuthingRuby::ManagementClient.new(@options)
24
+ random_phone = "135#{@helper.randomNumString(8)}"
24
25
  userInfo = {
25
- username: @helper.randomString, # 随机字符串,比如 "mpflok"
26
+ # username: @helper.randomString, # 随机字符串,比如 "mpflok"
26
27
  # username: 'SpongeBob3', # 或者明确指定用户名
27
- password: 'passw0rd',
28
+ phone: random_phone,
29
+ password: '123456789',
28
30
  }
29
- res = managementClient.users.create(userInfo)
30
- json = JSON.parse(res)
31
- # puts res
32
- # 如果成功
33
- # {"data":{"createUser":{"id":"608ab9828eab7e35e81bd732","arn":"arn:cn:authing:60800b8ee5b66b23128b4980:user:608ab9828eab7e35e81bd732","userPoolId":"60800b8ee5b66b23128b4980","status":"Activated","username":"SpongeBob2","email":null,"emailVerified":false,"phone":null,"phoneVerified":false,"unionid":null,"openid":null,"nickname":null,"registerSource":["import:manual"],"photo":"default-user-avatar.png","password":"91b133c2e13e40852505946b7e0c2f04","oauth":null,"token":null,"tokenExpiredAt":null,"loginsCount":0,"lastLogin":null,"lastIP":null,"signedUp":null,"blocked":false,"isDeleted":false,"device":null,"browser":null,"company":null,"name":null,"givenName":null,"familyName":null,"middleName":null,"profile":null,"preferredUsername":null,"website":null,"gender":"U","birthdate":null,"zoneinfo":null,"locale":null,"address":null,"formatted":null,"streetAddress":null,"locality":null,"region":null,"postalCode":null,"city":null,"province":null,"country":null,"createdAt":"2021-04-29T13:49:54+00:00","updatedAt":"2021-04-29T13:49:54+00:00","externalId":null}}}
31
+ hash = managementClient.users.create(userInfo)
34
32
 
35
- # 如果失败
33
+ # 成功
34
+ # {"id":"608ab9828eab7e35e81bd732","arn":"arn:cn:authing:60800b8ee5b66b23128b4980:user:608ab9828eab7e35e81bd732","userPoolId":"60800b8ee5b66b23128b4980","status":"Activated","username":"SpongeBob2","email":null,"emailVerified":false,"phone":null,"phoneVerified":false,"unionid":null,"openid":null,"nickname":null,"registerSource":["import:manual"],"photo":"default-user-avatar.png","password":"91b133c2e13e40852505946b7e0c2f04","oauth":null,"token":null,"tokenExpiredAt":null,"loginsCount":0,"lastLogin":null,"lastIP":null,"signedUp":null,"blocked":false,"isDeleted":false,"device":null,"browser":null,"company":null,"name":null,"givenName":null,"familyName":null,"middleName":null,"profile":null,"preferredUsername":null,"website":null,"gender":"U","birthdate":null,"zoneinfo":null,"locale":null,"address":null,"formatted":null,"streetAddress":null,"locality":null,"region":null,"postalCode":null,"city":null,"province":null,"country":null,"createdAt":"2021-04-29T13:49:54+00:00","updatedAt":"2021-04-29T13:49:54+00:00","externalId":null}
35
+
36
+ # 失败
36
37
  # {"errors":[{"message":{"code":2026,"message":"用户已存在,请勿重复创建!"},"locations":[{"line":2,"column":3}],"path":["createUser"],"extensions":{"code":"INTERNAL_SERVER_ERROR"}}],"data":null}
37
38
 
38
- assert(json.dig("data", "createUser") != nil, json)
39
+ assert(hash.dig("id") != nil, hash)
39
40
  end
40
41
 
41
42
  # 创建用户
@@ -49,10 +50,8 @@ class TestManagementClient < Minitest::Test
49
50
  loginsCount: 2, # 原有用户系统记录的用户登录次数
50
51
  signedUp: '2020-10-15T17:55:37+08:00' # 原有用户系统记录的用户注册时间
51
52
  }
52
- res = managementClient.users.create(userInfo)
53
- # puts res
54
- json = JSON.parse(res)
55
- assert(json.dig("data", "createUser") != nil, json)
53
+ hash = managementClient.users.create(userInfo)
54
+ assert(hash.dig("id") != nil, hash)
56
55
  end
57
56
 
58
57
  # 创建一个用户, 并返回这个用户
@@ -67,14 +66,12 @@ class TestManagementClient < Minitest::Test
67
66
  end
68
67
 
69
68
  managementClient = AuthingRuby::ManagementClient.new(@options)
70
- res = managementClient.users.create(userInfo)
71
- json = JSON.parse(res)
72
- user = json.dig("data", "createUser")
69
+ user = managementClient.users.create(userInfo)
73
70
  return user
74
71
  end
75
72
 
76
73
  # 更新用户
77
- # ruby ./lib/test/mini_test/TestManagementClient.rb -n test_update_user
74
+ # ruby ./lib/authing_ruby/test/mini_test/TestManagementClient.rb -n test_update_user
78
75
  def test_update_user
79
76
  # 第一步:创建用户
80
77
  user = create_random_user()
@@ -82,15 +79,17 @@ class TestManagementClient < Minitest::Test
82
79
 
83
80
  # 第二步:更新用户
84
81
  managementClient = AuthingRuby::ManagementClient.new(@options)
85
- res2 = managementClient.users.update(user_id, {
82
+ hash = managementClient.users.update(user_id, {
86
83
  nickname: 'Nick',
87
84
  })
88
- # puts res2
85
+ # puts hash
86
+ # 成功
87
+ # {"id"=>"60b902e844428416be3a25b8", "arn"=>"arn:cn:authing:60800b8ee5b66b23128b4980:user:60b902e844428416be3a25b8", "userPoolId"=>"60800b8ee5b66b23128b4980", "status"=>"Activated", "username"=>nil, "email"=>nil, "emailVerified"=>false, "phone"=>"17600009338", "phoneVerified"=>false, "unionid"=>nil, "openid"=>nil, "nickname"=>"Nick", "registerSource"=>["import:manual"], "photo"=>"https://files.authing.co/authing-console/default-user-avatar.png", "password"=>nil, "oauth"=>nil, "token"=>nil, "tokenExpiredAt"=>nil, "loginsCount"=>0, "lastLogin"=>nil, "lastIP"=>nil, "signedUp"=>"2021-06-03T16:27:20+00:00", "blocked"=>false, "isDeleted"=>false, "device"=>nil, "browser"=>nil, "company"=>nil, "name"=>nil, "givenName"=>nil, "familyName"=>nil, "middleName"=>nil, "profile"=>nil, "preferredUsername"=>nil, "website"=>nil, "gender"=>"U", "birthdate"=>nil, "zoneinfo"=>nil, "locale"=>nil, "address"=>nil, "formatted"=>nil, "streetAddress"=>nil, "locality"=>nil, "region"=>nil, "postalCode"=>nil, "city"=>nil, "province"=>nil, "country"=>nil, "createdAt"=>"2021-06-03T16:27:20+00:00", "updatedAt"=>"2021-06-03T16:27:22+00:00", "externalId"=>nil}
88
+
89
89
  # 如果失败
90
90
  # {"errors":[{"message":{"code":2004,"message":"用户不存在"},"locations":[{"line":2,"column":3}],"path":["updateUser"],"extensions":{"code":"INTERNAL_SERVER_ERROR"}}],"data":null}
91
91
 
92
- json2 = JSON.parse(res2)
93
- assert(json2.dig("data", "updateUser") != nil, json2)
92
+ assert(hash.dig("id") != nil, hash)
94
93
  end
95
94
 
96
95
  # 测试通过 ID 获取用户信息
@@ -100,26 +99,20 @@ class TestManagementClient < Minitest::Test
100
99
  user_id = user.dig("id")
101
100
 
102
101
  managementClient = AuthingRuby::ManagementClient.new(@options)
103
- res = managementClient.users.detail(user_id)
104
-
105
- json = JSON.parse(res)
106
- assert(json.dig("data", "user") != nil, json)
102
+ hash = managementClient.users.detail(user_id)
103
+ assert(hash.dig("id") != nil, hash)
107
104
  end
108
105
 
109
106
  # 测试删除用户
110
- # ruby ./lib/test/mini_test/TestManagementClient.rb -n test_delete
107
+ # ruby ./lib/authing_ruby/test/mini_test/TestManagementClient.rb -n test_delete
111
108
  def test_delete
112
109
  user = create_random_user()
113
110
  user_id = user.dig("id")
114
111
 
115
112
  managementClient = AuthingRuby::ManagementClient.new(@options)
116
- res = managementClient.users.delete(user_id)
117
-
118
- # puts res
119
- # {"data":{"deleteUser":{"message":"删除成功!","code":200}}}
120
-
121
- json = JSON.parse(res)
122
- assert(json.dig("data", "deleteUser") != nil, json)
113
+ hash = managementClient.users.delete(user_id)
114
+ # {"message":"删除成功!","code":200}
115
+ assert(hash.dig("code") == 200, hash)
123
116
  end
124
117
 
125
118
  # 测试删除多个用户
@@ -134,22 +127,17 @@ class TestManagementClient < Minitest::Test
134
127
  user_ids = [user1_id, user2_id]
135
128
 
136
129
  managementClient = AuthingRuby::ManagementClient.new(@options)
137
- res = managementClient.users.deleteMany(user_ids)
138
- # puts res
139
- # {"data":{"deleteUsers":{"message":"删除成功!","code":200}}}
140
-
141
- json = JSON.parse(res)
142
- assert(json.dig("data", "deleteUsers") != nil, json)
130
+ hash = managementClient.users.deleteMany(user_ids)
131
+ # {"message":"删除成功!","code":200}
132
+ assert(hash.dig("code") == 200, hash)
143
133
  end
144
134
 
145
135
  # 测试获取用户列表
146
- # ruby ./lib/test/mini_test/TestManagementClient.rb -n test_list
136
+ # ruby ./lib/authing_ruby/test/mini_test/TestManagementClient.rb -n test_list
147
137
  def test_list
148
138
  managementClient = AuthingRuby::ManagementClient.new(@options)
149
- res = managementClient.users.list()
150
- # puts res
151
- json = JSON.parse(res)
152
- assert(json.dig("data", "users") != nil, json)
139
+ hash = managementClient.users.list()
140
+ assert(hash.dig("totalCount") != nil, hash)
153
141
  end
154
142
 
155
143
  # 测试 检查用户是否存在 (返回 true | false)
@@ -173,7 +161,7 @@ class TestManagementClient < Minitest::Test
173
161
  end
174
162
 
175
163
  # 测试 查找用户 (返回这个用户)
176
- # ruby ./lib/test/mini_test/TestManagementClient.rb -n test_find
164
+ # ruby ./lib/authing_ruby/test/mini_test/TestManagementClient.rb -n test_find
177
165
  def test_find
178
166
  # 第一步:先创建用户
179
167
  userInfo = {
@@ -187,8 +175,8 @@ class TestManagementClient < Minitest::Test
187
175
  # "email": "haha2@qq.com",
188
176
  # "phone": "13700001111",
189
177
  }
190
- result = managementClient.users.find(options)
191
- assert(result.dig("data", "findUser"), result)
178
+ hash = managementClient.users.find(options)
179
+ assert(hash.dig("id"), hash)
192
180
  end
193
181
 
194
182
  end
@@ -12,7 +12,7 @@
12
12
 
13
13
  require "minitest/autorun"
14
14
  require "./lib/authing_ruby.rb"
15
- require "./lib/test/helper.rb"
15
+ require "./lib/authing_ruby/test/helper.rb"
16
16
  require 'dotenv'
17
17
  Dotenv.load('.env.test')
18
18
 
@@ -97,5 +97,49 @@ class TestSMSandEmail < Minitest::Test
97
97
  # 清理工作:测完了删除第一步注册的用户
98
98
  user_id = user['id']
99
99
  @managementClient.users.delete(user_id)
100
- end
101
- end
100
+ end
101
+
102
+ # 测试: 更新用户手机号
103
+ # ruby ./lib/authing_ruby/test/mini_test/TestSMSandEmail.rb -n test_updatePhone
104
+ # 文档: https://docs.authing.cn/v2/reference/sdk-for-node/authentication/AuthenticationClient.html#%E6%9B%B4%E6%96%B0%E7%94%A8%E6%88%B7%E6%89%8B%E6%9C%BA%E5%8F%B7
105
+ def test_updatePhone
106
+ # 前提条件:先确保有一个现有用户,可以进 Authing 手工新建一个,新建时设定手机号和密码,手机号随便填如 13511112222 密码 123456789
107
+
108
+ # 先登录:
109
+ phone = '13511112222'
110
+ password = '123456789'
111
+ user = @authenticationClient.loginByPhonePassword(phone, password)
112
+
113
+ # 填写要绑定的新手机号(可以填你自己的,这样才能收到短信)
114
+ phone = '13556136684'
115
+
116
+ # 给新手机号发送短信验证码 (把下面这行先取消注释, 收到短信后再注释上)
117
+ # puts manual_send_SMS(phone); return;
118
+
119
+ # 填写收到的短信验证码
120
+ code = '4874'
121
+
122
+ # 默认情况下,如果用户当前已经绑定了手机号,需要同时验证原有手机号
123
+ # 开发者也可以选择不开启 “验证原有手机号“ ,可以在 Authing 控制台 的 设置目录下的安全信息模块进行关闭。
124
+ # 单个用户池 -> 设置 -> 安全信息 -> 用户池安全设置 -> 修改手机号时是否验证旧手机号 -> 点击开关,切换为关闭 -> 右上角"保存"
125
+ # 由于没有2个手机号,这里是关闭后再测试
126
+ oldPhone = nil
127
+ oldPhoneCode = nil
128
+
129
+ updatePhoneResult = @authenticationClient.updatePhone(phone, code, oldPhone, oldPhoneCode)
130
+ puts updatePhoneResult
131
+ assert(updatePhoneResult.dig('id') != nil)
132
+
133
+ # 错误:
134
+ # {:code=>2020, :message=>"尚未登录,无访问权限", :data=>nil}
135
+ # {:code=>500, :message=>"该手机号已被绑定", :data=>nil}
136
+ # {:code=>2230, :message=>"新手机号和旧手机号一样", :data=>nil}
137
+ # {:code=>500, :message=>"修改手机号必须验证原来的手机号。", :data=>nil}
138
+ # {:code=>500, :message=>"验证码已过期", :data=>nil}
139
+ # {:code=>500, :message=>"验证码不正确!", :data=>nil}
140
+
141
+ # 成功会返回 User
142
+ # {"id"=>"60b5b17a9cf59b23b2bcbccb", "arn"=>"arn:cn:authing:60800b8ee5b66b23128b4980:user:60b5b17a9cf59b23b2bcbccb", "userPoolId"=>"60800b8ee5b66b23128b4980", "status"=>"Activated", "username"=>"测试更新手机号", "email"=>nil, "emailVerified"=>false, "phone"=>"13556136684", "phoneVerified"=>true, "unionid"=>nil, "openid"=>nil, "nickname"=>nil, "registerSource"=>["import:manual"], "photo"=>"https://files.authing.co/authing-console/default-user-avatar.png", "password"=>"871fde109c2f0f463cc35e0c3e840932", "oauth"=>nil, "token"=>"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2MGI1YjE3YTljZjU5YjIzYjJiY2JjY2IiLCJiaXJ0aGRhdGUiOm51bGwsImZhbWlseV9uYW1lIjpudWxsLCJnZW5kZXIiOiJVIiwiZ2l2ZW5fbmFtZSI6bnVsbCwibG9jYWxlIjpudWxsLCJtaWRkbGVfbmFtZSI6bnVsbCwibmFtZSI6bnVsbCwibmlja25hbWUiOm51bGwsInBpY3R1cmUiOiJodHRwczovL2ZpbGVzLmF1dGhpbmcuY28vYXV0aGluZy1jb25zb2xlL2RlZmF1bHQtdXNlci1hdmF0YXIucG5nIiwicHJlZmVycmVkX3VzZXJuYW1lIjpudWxsLCJwcm9maWxlIjpudWxsLCJ1cGRhdGVkX2F0IjoiMjAyMS0wNi0wMVQwNDoxNjo1MS41NDBaIiwid2Vic2l0ZSI6bnVsbCwiem9uZWluZm8iOm51bGwsImFkZHJlc3MiOnsiY291bnRyeSI6bnVsbCwicG9zdGFsX2NvZGUiOm51bGwsInJlZ2lvbiI6bnVsbCwiZm9ybWF0dGVkIjpudWxsfSwicGhvbmVfbnVtYmVyIjoiMTM1MTExMTIyMjIiLCJwaG9uZV9udW1iZXJfdmVyaWZpZWQiOmZhbHNlLCJlbWFpbCI6bnVsbCwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJleHRlcm5hbF9pZCI6bnVsbCwidW5pb25pZCI6bnVsbCwiZGF0YSI6eyJ0eXBlIjoidXNlciIsInVzZXJQb29sSWQiOiI2MDgwMGI4ZWU1YjY2YjIzMTI4YjQ5ODAiLCJhcHBJZCI6IjYwYjViMjFiZTMxMjkwNjI2ZmY2ZDgyZiIsImlkIjoiNjBiNWIxN2E5Y2Y1OWIyM2IyYmNiY2NiIiwidXNlcklkIjoiNjBiNWIxN2E5Y2Y1OWIyM2IyYmNiY2NiIiwiX2lkIjoiNjBiNWIxN2E5Y2Y1OWIyM2IyYmNiY2NiIiwicGhvbmUiOiIxMzUxMTExMjIyMiIsImVtYWlsIjpudWxsLCJ1c2VybmFtZSI6Iua1i-ivleabtOaWsOaJi-acuuWPtyIsInVuaW9uaWQiOm51bGwsIm9wZW5pZCI6bnVsbCwiY2xpZW50SWQiOiI2MDgwMGI4ZWU1YjY2YjIzMTI4YjQ5ODAifSwidXNlcnBvb2xfaWQiOiI2MDgwMGI4ZWU1YjY2YjIzMTI4YjQ5ODAiLCJhdWQiOiI2MGI1YjIxYmUzMTI5MDYyNmZmNmQ4MmYiLCJleHAiOjE2MjM3MzA2MzEsImlhdCI6MTYyMjUyMTAzMSwiaXNzIjoiaHR0cHM6Ly9tb3Jlbi5hdXRoaW5nLmNuL29pZGMifQ.VKSB6q-DBmtKLzOh_2qjBPQCSNZUAtrw_G2ZlNjOxbs", "tokenExpiredAt"=>"2021-06-15T04:17:11+00:00", "loginsCount"=>6, "lastLogin"=>"2021-06-01T04:17:11+00:00", "lastIP"=>nil, "signedUp"=>"2021-06-01T04:03:06+00:00", "blocked"=>false, "isDeleted"=>false, "device"=>nil, "browser"=>nil, "company"=>nil, "name"=>nil, "givenName"=>nil, "familyName"=>nil, "middleName"=>nil, "profile"=>nil, "preferredUsername"=>nil, "website"=>nil, "gender"=>"U", "birthdate"=>nil, "zoneinfo"=>nil, "locale"=>nil, "address"=>nil, "formatted"=>nil, "streetAddress"=>nil, "locality"=>nil, "region"=>nil, "postalCode"=>nil, "city"=>nil, "province"=>nil, "country"=>nil, "createdAt"=>"2021-06-01T04:03:06+00:00", "updatedAt"=>"2021-06-01T04:17:12+00:00"}
143
+ end
144
+
145
+ end
@@ -2,5 +2,5 @@
2
2
  # https://github.com/Authing/authing.js/blob/cf4757d09de3b44c3c3f4509ae8c8715c9f302a2/src/lib/version.ts
3
3
 
4
4
  module AuthingRuby
5
- VERSION = "1.0.9".freeze
5
+ VERSION = "1.1.4".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authing_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - 郑诚(Zheng Cheng)
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-25 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -189,6 +189,7 @@ files:
189
189
  - lib/authing_ruby/graphql/mutations/resetPassword.gql
190
190
  - lib/authing_ruby/graphql/mutations/sendEmail.gql
191
191
  - lib/authing_ruby/graphql/mutations/updatePassword.gql
192
+ - lib/authing_ruby/graphql/mutations/updatePhone.gql
192
193
  - lib/authing_ruby/graphql/mutations/updateUser.gql
193
194
  - lib/authing_ruby/graphql/queries/accessToken.gql
194
195
  - lib/authing_ruby/graphql/queries/checkLoginStatus.gql
@@ -688,7 +689,7 @@ homepage: https://github.com/1c7/authing_ruby
688
689
  licenses:
689
690
  - MIT
690
691
  metadata: {}
691
- post_install_message:
692
+ post_install_message:
692
693
  rdoc_options: []
693
694
  require_paths:
694
695
  - lib
@@ -703,8 +704,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
703
704
  - !ruby/object:Gem::Version
704
705
  version: '0'
705
706
  requirements: []
706
- rubygems_version: 3.0.3
707
- signing_key:
707
+ rubygems_version: 3.0.9
708
+ signing_key:
708
709
  specification_version: 4
709
710
  summary: Authing 的 Ruby SDK
710
711
  test_files: []