Sha256: 3535925ac2922d79812ecfde6990b7f8eaf04c1be2e6ded82db5c4beccfca75a

Contents?: true

Size: 1.06 KB

Versions: 12

Compression:

Stored size: 1.06 KB

Contents

include_set Abstract::AccountField

# DURATIONS = "second|minute|hour|day|week|month|year".freeze

def history?
  false
end

view :raw do
  tr :private_data
end

def validate! api_key
  error =
    case
    when !real?             then [:token_not_found, tr(:error_token_not_found)]
    # when expired?           then [:token_expired, tr(:error_token_expired)]
    when content != api_key then [:incorrect_token, tr(:error_incorrect_token)]
    end
  errors.add(*error) if error
  error.nil?
end

# def expired?
#   !permanent? && updated_at <= term.ago
# end
#
# def permanent?
#   term == "permanent"
# end

# def term
#   @term ||=
#     if expiration.present?
#       term_from_string expiration
#     else
#       Card.config.token_expiry
#     end
# end

# def term_from_string string
#   string.strip!
#   return "permanent" if string == "none"
#   re_match = /^(\d+)[\.\s]*(#{DURATIONS})s?$/.match(string)
#   number, unit = re_match.captures if re_match
#   raise Card::Open::Error, tr(:exception_bad_expiration, example: '2 days') unless unit
#   number.to_i.send unit
# end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
card-mod-account-0.11.3 set/right/api_key.rb
card-mod-account-0.11.2 set/right/api_key.rb
card-mod-account-0.11.1 set/right/api_key.rb
card-mod-account-0.11.0 set/right/api_key.rb
card-1.100.0 mod/account/set/right/api_key.rb
card-1.99.6 mod/account/set/right/api_key.rb
card-1.99.5 mod/account/set/right/api_key.rb
card-1.99.4 mod/account/set/right/api_key.rb
card-1.99.3 mod/account/set/right/api_key.rb
card-1.99.2 mod/account/set/right/api_key.rb
card-1.99.1 mod/account/set/right/api_key.rb
card-1.99.0 mod/account/set/right/api_key.rb