Sha256: 9fd5d9a8b945806b3c40db2fefba45ab0dc406665f14f777502698374a0b931a

Contents?: true

Size: 961 Bytes

Versions: 9

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true

module IronBank
  module Actions
    # Query Zuora using ZOQL
    # https://knowledgecenter.zuora.com/DC_Developers/K_Zuora_Object_Query_Language
    #
    class Query < Action
      # Zuora's default is 2,000 records, but we simply use `0` here to not pass
      # the parameter to Zuora APIs during the query call.
      #
      # See https://knowledgecenter.zuora.com/DC_Developers/BC_ZOQL#Limits
      #
      DEFAULT_ZUORA_LIMIT = 0

      def self.call(zoql, limit: DEFAULT_ZUORA_LIMIT)
        new(zoql, limit).call
      end

      private

      attr_reader :zoql, :limit

      def initialize(zoql, limit)
        @zoql  = zoql
        @limit = limit

        super(zoql: zoql, limit: limit)
      end

      def params
        return required_params if limit.zero?

        required_params.merge(conf: { batchSize: limit })
      end

      def required_params
        { queryString: zoql }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iron_bank-5.4.1 lib/iron_bank/actions/query.rb
iron_bank-5.4.0 lib/iron_bank/actions/query.rb
iron_bank-5.3.2 lib/iron_bank/actions/query.rb
iron_bank-5.3.0 lib/iron_bank/actions/query.rb
iron_bank-5.2.6 lib/iron_bank/actions/query.rb
iron_bank-5.2.4 lib/iron_bank/actions/query.rb
iron_bank-5.2.3 lib/iron_bank/actions/query.rb
iron_bank-5.2.0 lib/iron_bank/actions/query.rb
iron_bank-5.1.1 lib/iron_bank/actions/query.rb