class PlentyClient::Config
Constants
- ATTEMPT_COUNT
- LOGIN_RENEW_BUFFER
When
expiry_date
is less than this many seconds from now, it should renew API keys
Attributes
access_token[RW]
api_password[RW]
api_user[RW]
attempt_count[W]
expiry_date[RW]
log[RW]
plenty_id[RW]
refresh_token[RW]
site_url[RW]
Public Class Methods
attempt_count()
click to toggle source
# File lib/plenty_client/config.rb, line 24 def attempt_count @attempt_count || ATTEMPT_COUNT end
tokens_present?()
click to toggle source
# File lib/plenty_client/config.rb, line 20 def tokens_present? !access_token.nil? && !refresh_token.nil? end
tokens_valid?()
click to toggle source
# File lib/plenty_client/config.rb, line 28 def tokens_valid? tokens_present? && expiry_date.instance_of?(Time) && expiry_date > Time.now && (expiry_date - Time.now > LOGIN_RENEW_BUFFER) end
validate_credentials()
click to toggle source
# File lib/plenty_client/config.rb, line 16 def validate_credentials raise NoCredentials if site_url.nil? || api_user.nil? || api_password.nil? end