module LogicalModel::ApiKey::ClassMethods
Attributes
api_key[RW]
api_key_name[RW]
use_api_key[RW]
Public Instance Methods
merge_key(params = {})
click to toggle source
if needed will merge api_key
into given hash returns merged hash
# File lib/logical_model/api_key.rb, line 31 def merge_key(params = {}) if self.use_api_key params.merge({self.api_key_name => self.api_key}) else params end end
set_api_key(name,value)
click to toggle source
Set api_key
@param name [Symbol] name for api_key. Eg: app_key, token, etc. @param value [String] value of key. Eg: 1o2u3hqkfd, secret, etc.
@example
class Client < LogicalModel set_api_key(:token, 'asdfasdf') ... end
# File lib/logical_model/api_key.rb, line 19 def set_api_key(name,value) @use_api_key = true @api_key_name = name @api_key = value end