Class: Workarea::Api::Storefront::SavedCreditCardsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/api/storefront/saved_credit_cards_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#assert_current_metrics_id, #cache_page, #skip_session

Methods included from Authentication

#authentication?, #current_user, find_user

Instance Method Details

#createObject



15
16
17
18
# File 'app/controllers/workarea/api/storefront/saved_credit_cards_controller.rb', line 15

def create
  @credit_card = @payment_profile.credit_cards.create!(card_params)
  render :show
end

#destroyObject



27
28
29
30
# File 'app/controllers/workarea/api/storefront/saved_credit_cards_controller.rb', line 27

def destroy
  @payment_profile.credit_cards.find(params[:id]).destroy
  head :no_content
end

#indexObject



7
8
9
# File 'app/controllers/workarea/api/storefront/saved_credit_cards_controller.rb', line 7

def index
  @credit_cards = @payment_profile.credit_cards
end

#showObject



11
12
13
# File 'app/controllers/workarea/api/storefront/saved_credit_cards_controller.rb', line 11

def show
  @credit_card = @payment_profile.credit_cards.find(params[:id])
end

#updateObject



20
21
22
23
24
25
# File 'app/controllers/workarea/api/storefront/saved_credit_cards_controller.rb', line 20

def update
  @credit_card = @payment_profile.credit_cards.find(params[:id])

  @credit_card.update_attributes!(card_params)
  render :show
end