Class: PriceHubble::Authentication

Inherits:
BaseEntity show all
Defined in:
lib/pricehubble/entity/authentication.rb

Overview

The PriceHubble ecosystem is built around the authentication on each request. This entity provides a simple to use interface for it.

Constant Summary collapse

EXPIRATION_LEEWAY =

The expiration leeway to substract to guarantee acceptance on remote application calls

5.minutes

Instance Attribute Summary collapse

Attributes inherited from BaseEntity

#_unmapped

Instance Method Summary collapse

Methods inherited from BaseEntity

inherited, #initialize

Methods included from Utils::Bangers

bangers

Methods included from EntityConcern::Persistence

#destroyed?, #mark_as_destroyed, #new_record?, #persisted?

Methods included from EntityConcern::Client

#client, client

Methods included from EntityConcern::Associations

has_many, has_one, inherited_setup_associations

Methods included from EntityConcern::Attributes

#assign_attributes, #attributes, inherited_setup_attributes, tracked_attr, typed_attr

Methods included from EntityConcern::Attributes::StringInquirer

typed_attr_string_inquirer

Methods included from EntityConcern::Attributes::Range

typed_attr_range

Methods included from EntityConcern::Attributes::Enum

typed_attr_enum

Methods included from EntityConcern::Attributes::DateArray

typed_attr_date_array

Constructor Details

This class inherits a constructor from PriceHubble::BaseEntity

Instance Attribute Details

#created_atObject (readonly)

Add some runtime attributes



17
18
19
# File 'lib/pricehubble/entity/authentication.rb', line 17

def created_at
  @created_at
end

#expires_atObject (readonly)

Add some runtime attributes



17
18
19
# File 'lib/pricehubble/entity/authentication.rb', line 17

def expires_at
  @expires_at
end

Instance Method Details

#expired?Boolean

Allow to query whenever the current authentication instance is expired or not. This includes also a small leeway to ensure the acceptance is guaranteed.

Returns:

  • (Boolean)

    whenever the authentication instance is expired or not



30
31
32
# File 'lib/pricehubble/entity/authentication.rb', line 30

def expired?
  Time.current >= expires_at
end