Class: RestClient

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/generators/restful_api_authentication/install/templates/rest_client.rb

Instance Method Summary collapse

Instance Method Details

#gen_api_keyObject

generates a new API key



15
16
17
18
# File 'lib/generators/restful_api_authentication/install/templates/rest_client.rb', line 15

def gen_api_key
  u = UUID.new
  self.api_key = u.generate
end

#gen_secretObject

generates a new secret



21
22
23
24
25
# File 'lib/generators/restful_api_authentication/install/templates/rest_client.rb', line 21

def gen_secret
  u = UUID.new
  d = Digest::SHA256.new << u.generate
  self.secret = d.to_s
end