Skip to content

Commit c1e2591

Browse files
committedJul 15, 2024··
#123 fixed
1 parent 113fbdf commit c1e2591

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed
 

‎lib/glogin/cookie.rb

+4-9
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,10 @@ class Open
9191
def initialize(json, secret, context = '')
9292
raise 'JSON can\'t be nil' if json.nil?
9393
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
10398
raise 'Secret can\'t be nil' if secret.nil?
10499
@secret = secret
105100
raise 'Context can\'t be nil' if context.nil?

0 commit comments

Comments
 (0)
Please sign in to comment.