Module: BillingLogic::CurrentStateMixin
- Included in:
- CurrentState
- Defined in:
- lib/billing_logic/current_state_mixin.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#active_products ⇒ Array
Returns array with only BillingEngine::Client::Products belonging to the CurrentState’s active (i.e., enabled & active/pending) PaymentProfiles.
-
#current_products ⇒ Array
Returns array with only BillingEngine::Client::Products belonging to the CurrentState’s current (i.e., currently paid-up) PaymentProfiles.
-
#each(&block) ⇒ Object
Iterates through profiles, yielding each one-by-one to the block for processing.
Class Method Details
.included(clazz) ⇒ Object
3 4 5 6 |
# File 'lib/billing_logic/current_state_mixin.rb', line 3 def self.included(clazz) clazz.send(:attr_accessor, :profiles) clazz.send(:include, Enumerable) end |
Instance Method Details
#active_products ⇒ Array
Returns array with only BillingEngine::Client::Products belonging to the CurrentState’s active (i.e., enabled & active/pending) PaymentProfiles
28 29 30 |
# File 'lib/billing_logic/current_state_mixin.rb', line 28 def active_products map { |profile| profile.active_products }.flatten end |
#current_products ⇒ Array
Returns array with only BillingEngine::Client::Products belonging to the CurrentState’s current (i.e., currently paid-up) PaymentProfiles
18 19 20 |
# File 'lib/billing_logic/current_state_mixin.rb', line 18 def current_products map { |profile| profile.current_products }.flatten end |
#each(&block) ⇒ Object
Iterates through profiles, yielding each one-by-one to the block for processing
9 10 11 |
# File 'lib/billing_logic/current_state_mixin.rb', line 9 def each(&block) profiles.each(&block) end |