Sha256: 2fdb19d039c0161e855770d33f57ac2e516293cf51ede038090a0aecf5278f7b

Contents?: true

Size: 873 Bytes

Versions: 13

Compression:

Stored size: 873 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
      # Zuora limitation: we cannot query for `ActiveCurrencies` with any other
      # fields, so instead we define a separate `#active_currencies` method.
      def self.exclude_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

13 entries across 13 versions & 1 rubygems

Version Path
iron_bank-3.4.0 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.3.4 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.3.3 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.3.2 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.3.1 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.3.0 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.2.0 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.1.1 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.1.0 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.0.3 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.0.2 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.0.1 lib/iron_bank/resources/product_rate_plan.rb
iron_bank-3.0.0 lib/iron_bank/resources/product_rate_plan.rb