Class: Workarea::Api::Admin::ShippingRatesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #sort_direction, #sort_field

Instance Method Details

#createObject



93
94
95
96
97
98
99
100
# File 'app/controllers/workarea/api/admin/shipping_rates_controller.rb', line 93

def create
  @rate = @shipping_service.rates.create!(params[:rate])
  respond_with(
    { rate: @rate },
    { status: :created,
    location: shipping_service_rates_path(@shipping_service) }
  )
end

#destroyObject



215
216
217
218
# File 'app/controllers/workarea/api/admin/shipping_rates_controller.rb', line 215

def destroy
  @rate.destroy
  head :no_content
end

#indexObject



89
90
91
# File 'app/controllers/workarea/api/admin/shipping_rates_controller.rb', line 89

def index
  respond_with rates: @shipping_service.rates
end

#updateObject



210
211
212
213
# File 'app/controllers/workarea/api/admin/shipping_rates_controller.rb', line 210

def update
  @rate.update_attributes!(params[:rate])
  respond_with rate: @rate
end