glogin 0.16.3 → 0.16.4

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: eda8e66e30f5f90d9a125ca84f104c5bddaf38f9b0ac2381935ee9dac92aff70
4
- data.tar.gz: 74d58b5818dbd3f0809336de8895866aa8d9f1a01aa326ba1f1d73fc1383ebab
3
+ metadata.gz: 6da39333e7c8e05cc42066d15bd2fa172f5eb7e503b7f422a62c9d0c5351ef1c
4
+ data.tar.gz: 02cb9b83d920882d11e75f678c32dd3239459533c9241aab351ef1edbc02c6fa
5
5
  SHA512:
6
- metadata.gz: 63ec19df364df3d7db038e71798dff21713df174ecbddb3ef8e26de8a0a76d2c39efaed520809252bf42f0bbf077fd3628f65e006126a56e64ba8fe19700233d
7
- data.tar.gz: 280d55cd553045833c0fb23e58918db97659a7f270efa1837223f2d02b781a5e9a60b7db5b96f86aaf9eb4b6fa897d147de5f258c0ecf55c9e4b545fd40a235f
6
+ metadata.gz: 917708f2dc15758bfefb2f49baa33290057d01e5d4d2be1fd78e2f2bd9d3f4ca89cf5a2383f0ad060b2cd08f646a1a735c351843cd10b6a2867037f2261fe218
7
+ data.tar.gz: 93aeab81b46ed7b211e0da2452c8cf5fde102fe458750b83425dc62e4462ca54b9bed88f2a91311c635a8483c0a019f89204eee4f46ddd392c99531bb4797ee4
data/lib/glogin/cookie.rb CHANGED
@@ -91,15 +91,10 @@ module GLogin
91
91
  def initialize(json, secret, context = '')
92
92
  raise 'JSON can\'t be nil' if json.nil?
93
93
  raise 'JSON must contain "id" key' if json['id'].nil?
94
- json.each do |k, v|
95
- raise "The key #{k} is not a string" unless k.is_a?(String)
96
- raise "The key #{k} is not allowed" unless %w[id login avatar_url bearer].include?(k)
97
- raise "The value '#{v}' of #{k} is not String or Integer" unless v.is_a?(String) || v.is_a?(Integer)
98
- end
99
- @id = json['id']
100
- @login = json['login'] || ''
101
- @avatar_url = json['avatar_url'] || ''
102
- @bearer = json['bearer'] || ''
94
+ @id = json['id'].to_s
95
+ @login = (json['login'] || '').to_s
96
+ @avatar_url = (json['avatar_url'] || '').to_s
97
+ @bearer = (json['bearer'] || '').to_s
103
98
  raise 'Secret can\'t be nil' if secret.nil?
104
99
  @secret = secret
105
100
  raise 'Context can\'t be nil' if context.nil?
@@ -26,5 +26,5 @@
26
26
  # Copyright:: Copyright (c) 2017-2024 Yegor Bugayenko
27
27
  # License:: MIT
28
28
  module GLogin
29
- VERSION = '0.16.3'
29
+ VERSION = '0.16.4'
30
30
  end
@@ -30,7 +30,7 @@ class TestCookie < Minitest::Test
30
30
  user = GLogin::Cookie::Closed.new(
31
31
  GLogin::Cookie::Open.new(
32
32
  JSON.parse(
33
- "{\"id\":123,
33
+ "{\"id\":123,\"node_id\":\"how are you?\",
34
34
  \"login\":\"yegor256\",
35
35
  \"avatar_url\":\"https://avatars1.githubusercontent.com/u/526301\"}"
36
36
  ),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.3
4
+ version: 0.16.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko