Class: Spree::Api::CreditCardsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/credit_cards_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Instance Method Details

#indexObject



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/spree/api/credit_cards_controller.rb', line 9

def index
  @credit_cards = user
    .credit_cards
    .accessible_by(current_ability)
    .with_payment_profile
    .ransack(params[:q]).result

  @credit_cards = paginate(@credit_cards)
  respond_with(@credit_cards)
end

#updateObject



20
21
22
23
24
25
26
# File 'app/controllers/spree/api/credit_cards_controller.rb', line 20

def update
  if @credit_card.update(credit_card_update_params)
    respond_with(@credit_card, default_template: :show)
  else
    invalid_resource!(@credit_card)
  end
end