Class: Osm::OnlinePayment::Schedule::PaymentStatus
- Defined in:
- lib/osm/online_payment.rb,
lib/osm/online_payment.rb
Overview
Ensure the constant exists for validators
Constant Summary collapse
- VALID_STATUSES =
[:required, :not_required, :initiated, :paid, :received, :paid_manually]
Constants inherited from Model
Instance Method Summary collapse
- #<=>(another) ⇒ Object
-
#initialize ⇒ Object
constructor
Initialize a new PaymentStatus.
-
#initiated? ⇒ Boolean
Whether the status is :initiated.
- #inspect ⇒ Object
-
#not_required? ⇒ Boolean
Whether the status is :not_required.
-
#paid? ⇒ Boolean
Whether the status is :paid.
-
#paid_manually? ⇒ Boolean
Whether the status is :paid_manually.
-
#received? ⇒ Boolean
Whether the status is :received.
-
#required? ⇒ Boolean
Whether the status is :required.
Methods inherited from Model
#<, #<=, #>, #>=, #between?, #changed_attributes, configure, #reset_changed_attributes, #to_i
Constructor Details
#initialize ⇒ Object
Initialize a new PaymentStatus
|
# File 'lib/osm/online_payment.rb', line 445
|
Instance Method Details
#<=>(another) ⇒ Object
475 476 477 478 479 480 |
# File 'lib/osm/online_payment.rb', line 475 def <=>(another) result = -(self. <=> another.try(:timestamp)) result = self.payment <=> another.try(:payment) if result.eql?(0) result = self.id <=> another.try(:id) if result.eql?(0) return result end |
#initiated? ⇒ Boolean
Whether the status is :initiated
468 469 470 471 472 |
# File 'lib/osm/online_payment.rb', line 468 VALID_STATUSES.each do |attribute| define_method "#{attribute}?" do status.eql?(attribute) end end |
#inspect ⇒ Object
482 483 484 |
# File 'lib/osm/online_payment.rb', line 482 def inspect Osm.inspect_instance(self, {:replace_with => {'payment' => :id}}) end |
#not_required? ⇒ Boolean
Whether the status is :not_required
468 469 470 471 472 |
# File 'lib/osm/online_payment.rb', line 468 VALID_STATUSES.each do |attribute| define_method "#{attribute}?" do status.eql?(attribute) end end |
#paid? ⇒ Boolean
Whether the status is :paid
468 469 470 471 472 |
# File 'lib/osm/online_payment.rb', line 468 VALID_STATUSES.each do |attribute| define_method "#{attribute}?" do status.eql?(attribute) end end |
#paid_manually? ⇒ Boolean
Whether the status is :paid_manually
468 469 470 471 472 |
# File 'lib/osm/online_payment.rb', line 468 VALID_STATUSES.each do |attribute| define_method "#{attribute}?" do status.eql?(attribute) end end |
#received? ⇒ Boolean
Whether the status is :received
468 469 470 471 472 |
# File 'lib/osm/online_payment.rb', line 468 VALID_STATUSES.each do |attribute| define_method "#{attribute}?" do status.eql?(attribute) end end |
#required? ⇒ Boolean
Whether the status is :required
468 469 470 471 472 |
# File 'lib/osm/online_payment.rb', line 468 VALID_STATUSES.each do |attribute| define_method "#{attribute}?" do status.eql?(attribute) end end |