Class: Workarea::Api::Admin::GiftCardsController
- Inherits:
-
Admin::ApplicationController
- Object
- Admin::ApplicationController
- Workarea::Api::Admin::GiftCardsController
- Defined in:
- app/controllers/workarea/api/admin/gift_cards_controller.rb
Instance Method Summary collapse
Instance Method Details
#bulk ⇒ Object
291 292 293 294 295 296 297 298 |
# File 'app/controllers/workarea/api/admin/gift_cards_controller.rb', line 291 def bulk @bulk = Api::Admin::BulkUpsert.create!( klass: Payment::GiftCard, data: params[:gift_cards].map(&:to_h) ) head :no_content end |
#create ⇒ Object
107 108 109 110 111 112 113 114 115 116 |
# File 'app/controllers/workarea/api/admin/gift_cards_controller.rb', line 107 def create @gift_card = Payment::GiftCard.create!(params[:gift_card]) respond_with( { gift_card: @gift_card }, { status: :created, location: gift_card_path(@gift_card) } ) end |
#destroy ⇒ Object
257 258 259 260 |
# File 'app/controllers/workarea/api/admin/gift_cards_controller.rb', line 257 def destroy @gift_card.destroy head :no_content end |
#index ⇒ Object
98 99 100 101 102 103 104 105 |
# File 'app/controllers/workarea/api/admin/gift_cards_controller.rb', line 98 def index @gift_cards = Payment::GiftCard .all .order_by(sort_field => sort_direction) .page(params[:page]) respond_with gift_cards: @gift_cards end |
#show ⇒ Object
248 249 250 |
# File 'app/controllers/workarea/api/admin/gift_cards_controller.rb', line 248 def show respond_with gift_card: @gift_card end |
#update ⇒ Object
252 253 254 255 |
# File 'app/controllers/workarea/api/admin/gift_cards_controller.rb', line 252 def update @gift_card.update_attributes!(params[:gift_card]) respond_with gift_card: @gift_card end |