Sha256: 708191d75264c1a0933146708fd6dbd0b322ba93cfd30e328d0f070166ee61a7

Contents?: true

Size: 937 Bytes

Versions: 21

Compression:

Stored size: 937 Bytes

Contents

# frozen_string_literal: true

module IronBank
  module Resources
    # A product rate plan belongs to a product and holds many product rate plan
    # charges. It represents what a customer is subscribing to.
    #
    class ProductRatePlan < Resource
      # NOTE: Zuora doesn't let us query for more than one product rate plan
      #       `ActiveCurrencies` at a time
      def self.excluded_fields
        super + single_resource_query_fields
      end

      def self.single_resource_query_fields
        %w[ActiveCurrencies]
      end

      with_schema
      with_local_records
      with_cache

      with_one  :product
      with_many :product_rate_plan_charges, alias: :charges

      def active_currencies
        query_string = IronBank::QueryBuilder.zoql(
          self.class.object_name,
          ["ActiveCurrencies"],
          id: id
        )

        IronBank.client.query(query_string)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
iron_bank-4.0.2 lib/iron_bank/resources/product_rate_plan.rb