Class: Foobara::Auth::Types::Token
- Inherits:
-
Entity
- Object
- Model
- DetachedEntity
- Entity
- Foobara::Auth::Types::Token
- Defined in:
- foobara-auth-0.0.9/src/types/token.rb,
foobara-auth-0.0.9/src/types/token/state.rb,
foobara-auth-0.0.9/src/types/token/state_machine.rb
Defined Under Namespace
Classes: StateMachine
Constant Summary collapse
- State =
Foobara::Enumerated.make_module(StateMachine.states)
Instance Attribute Summary
Attributes included from Entity::Concerns::Persistence
#is_built, #is_created, #is_hard_deleted, #is_loaded, #is_persisted, #persisted_attributes
Attributes included from Entity::Concerns::Callbacks
Attributes inherited from Model
Instance Method Summary collapse
- #active? ⇒ Boolean
- #approve! ⇒ Object
- #expire! ⇒ Object
- #inactive? ⇒ Boolean
- #state_machine ⇒ Object
- #use_up! ⇒ Object
Methods inherited from Entity
Methods included from Entity::NewPrepend
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Methods included from Entity::Concerns::Initialization
Methods included from Entity::Concerns::Persistence
#built?, #created?, #dirty?, #hard_delete!, #hard_delete_without_callbacks!, #hard_deleted?, #load_if_necessary!, #loaded?, #persisted?, #restore!, #restore_without_callbacks!, #save_persisted_attributes, #to_persisted_attributes, #unhard_delete!, #verify_not_hard_deleted!
Methods included from Entity::Concerns::Attributes
#read_attribute, #read_attribute!, #values_at, #with_changed_attribute_callbacks, #write_attribute, #write_attribute!, #write_attribute_without_callbacks, #write_attribute_without_callbacks!, #write_attributes, #write_attributes_without_callbacks
Methods included from Entity::Concerns::Mutations
Methods included from Entity::Concerns::Callbacks
#fire, #initialize, reset_all, #without_callbacks
Methods inherited from DetachedEntity
Methods included from DetachedEntity::Concerns::Serialize
Methods included from DetachedEntity::Concerns::PrimaryKey
Methods included from DetachedEntity::Concerns::Equality
Methods inherited from Model
#==, abstract, abstract?, attribute_names, #attributes, #attributes_with_delegates, #cast_attribute, #cast_attribute!, closest_namespace_module, description, domain, domain_name, #eql?, foobara_model_name, foobara_name, full_model_name, #hash, #initialize, install!, organization_name, possible_errors, #read_attribute, #read_attribute!, reset_all, subclass, #to_h, #to_json, #valid?, valid_attribute_name?, #validate!, validate_attribute_name!, #validation_errors, #write_attribute, #write_attribute!, #write_attributes, #write_attributes!
Instance Method Details
#active? ⇒ Boolean
37 38 39 |
# File 'foobara-auth-0.0.9/src/types/token.rb', line 37 def active? state_machine.current_state == State::ACTIVE end |
#approve! ⇒ Object
21 22 23 |
# File 'foobara-auth-0.0.9/src/types/token.rb', line 21 def approve! state_machine.approve! end |
#expire! ⇒ Object
29 30 31 |
# File 'foobara-auth-0.0.9/src/types/token.rb', line 29 def expire! state_machine.expire! end |
#inactive? ⇒ Boolean
33 34 35 |
# File 'foobara-auth-0.0.9/src/types/token.rb', line 33 def inactive? state_machine.current_state == State::INACTIVE end |
#state_machine ⇒ Object
17 18 19 |
# File 'foobara-auth-0.0.9/src/types/token.rb', line 17 def state_machine @state_machine ||= StateMachine.new(owner: self, target_attribute: :state) end |
#use_up! ⇒ Object
25 26 27 |
# File 'foobara-auth-0.0.9/src/types/token.rb', line 25 def use_up! state_machine.use_up! end |