Sha256: 2c8c7ccbfeadfc2f34a9dfe473a650f7dd865129346b3d40ecaef33a06460a72

Contents?: true

Size: 665 Bytes

Versions: 43

Compression:

Stored size: 665 Bytes

Contents

module Spree
  module Api
    module V1
      class CreditCardsController < Spree::Api::BaseController
        before_action :user

        def index
          @credit_cards = user
            .credit_cards
            .accessible_by(current_ability, :read)
            .with_payment_profile
            .ransack(params[:q]).result.page(params[:page]).per(params[:per_page])
          respond_with(@credit_cards)
        end

        private

          def user
            if params[:user_id].present?
              @user ||= Spree::user_class.accessible_by(current_ability, :read).find(params[:user_id])
            end
          end

      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
spree_api-3.2.9 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.14 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.6 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.2.8 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.13 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.5 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.4 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.2.7 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.12 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.3 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.2.6 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.11 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.10 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.2 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.2.5 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.9 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.1 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.2.4 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.1.8 app/controllers/spree/api/v1/credit_cards_controller.rb
spree_api-3.3.0 app/controllers/spree/api/v1/credit_cards_controller.rb