File tree 1 file changed +4
-9
lines changed
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -91,15 +91,10 @@ class Open
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?
You can’t perform that action at this time.
0 commit comments