Class: AffiliationState
- Inherits:
-
Object
- Object
- AffiliationState
- Defined in:
- app/models/affiliation_state.rb
Overview
The state of an Affiliation.
When an Affiliation is created by the Customer, it's in the
pending
state.
When the counterpart confirms, it goes to the trusted
state.
When an Provider reports abuse, it goes to the blocked
state.
When an Affiliation is created by the Provider, it's already
considered trusted
.
Instance Attribute Summary (collapse)
-
- (String) label
The label that describes the AffiliationState.
Instance Method Summary (collapse)
-
- (Boolean) block(affiliation)
If the Affiliation is in the
pending
state, transition it to theblocked
state. -
- (Boolean) confirm(affiliation)
If the Affiliation is in the
pending
state, transition it to thetrusted
state. -
- (Boolean) unblock(affiliation)
If the Affiliation is in the
pending
state, do nothing.
Instance Attribute Details
- (String) label
Returns the label that describes the AffiliationState.
14 15 16 |
# File 'app/models/affiliation_state.rb', line 14 def label @label end |
Instance Method Details
- (Boolean) block(affiliation)
If the Affiliation is in the pending
state, transition it to
the blocked
state.
If the Affiliation is in the trusted
state, transition it to
the blocked
state.
If the Affiliation is in the blocked
state, do nothing.
38 39 |
# File 'app/models/affiliation_state.rb', line 38 def block affiliation end |
- (Boolean) confirm(affiliation)
If the Affiliation is in the pending
state, transition it to
the trusted
state.
If the Affiliation is in the trusted
state, do nothing.
If the Affiliation is in the blocked
state, fail.
25 26 |
# File 'app/models/affiliation_state.rb', line 25 def confirm affiliation end |
- (Boolean) unblock(affiliation)
If the Affiliation is in the pending
state, do nothing.
If the Affiliation is in the trusted
state, do nothing.
If the Affiliation is in the blocked
state, transition it to
the trusted
state.
50 51 |
# File 'app/models/affiliation_state.rb', line 50 def unblock affiliation end |