Sha256: 827e787d21b0c9eab66be9c716a8e1ff4b5058ade28de6bc4196cf71c0551a49
Contents?: true
Size: 1.74 KB
Versions: 16
Compression:
Stored size: 1.74 KB
Contents
module Caboose class ShippingAddressesController < Caboose::ApplicationController # GET /admin/orders/:order_id/shipping-address/json def admin_json return if !user_is_allowed('orders', 'edit') order = Order.find(params[:order_id]) render :json => order.shipping_address end # PUT /admin/orders/:order_id/shipping-address def admin_update return if !user_is_allowed('orders', 'edit') resp = Caboose::StdClass.new({'attributes' => {}}) order = Order.find(params[:order_id]) sa = order.shipping_address save = true params.each do |name, value| case name when 'name' then sa.name = value when 'first_name' then sa.first_name = value when 'last_name' then sa.last_name = value when 'street' then sa.street = value when 'address1' then sa.address1 = value when 'address2' then sa.address2 = value when 'company' then sa.company = value when 'city' then sa.city = value when 'state' then sa.state = value when 'province' then sa.province = value when 'province_code' then sa.province_code = value when 'zip' then sa.zip = value when 'country' then sa.country = value when 'country_code' then sa.country_code = value when 'phone' then sa.phone = value end end resp.success = save && sa.save render :json => resp end end end
Version data entries
16 entries across 16 versions & 1 rubygems