Sha256: c307bb097442261e9003658eef3f795296535eb5092571e23d26e73bb2f7f021

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

module ESA
  module ContextProviders
    class AccountContextProvider < ESA::ContextProvider
      def self.provided_types
        ["ESA::Contexts::AccountContext"]
      end

      def self.context_id(context, options = {})
        context.account_id
      end

      def self.contained_ids(context, options = {})
        context.amounts.pluck(:account_id).uniq
      end

      def self.instantiate(parent, namespace, id, options = {})
        ESA::Contexts::AccountContext.new(chart_id: parent.chart_id, parent_id: parent.id, namespace: namespace, account_id: id)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
event_sourced_accounting-0.1.4 lib/esa/context_providers/account_context_provider.rb
event_sourced_accounting-0.1.3 lib/esa/context_providers/account_context_provider.rb
event_sourced_accounting-0.1.1 lib/esa/context_providers/account_context_provider.rb
event_sourced_accounting-0.1.0 app/models/esa/context_providers/account_context_provider.rb