Class: Caboose::StoreController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Caboose::StoreController
- Defined in:
- app/controllers/caboose/store_controller.rb
Instance Method Summary collapse
-
#admin_edit_general ⇒ Object
GET /admin/store.
-
#admin_edit_packages ⇒ Object
GET /admin/store/packages.
-
#admin_edit_payment ⇒ Object
GET /admin/store/payment.
-
#admin_edit_shipping ⇒ Object
GET /admin/store/shipping.
-
#admin_edit_tax ⇒ Object
GET /admin/store/tax.
-
#admin_update ⇒ Object
PUT /admin/store.
-
#length_unit_options ⇒ Object
GET /admin/store/length-unit-options.
-
#payment_processor_options ⇒ Object
GET /admin/store/payment-processor-options.
-
#weight_unit_options ⇒ Object
GET /admin/store/weight-unit-options.
Methods inherited from ApplicationController
#admin_add, #admin_bulk_add, #admin_bulk_delete, #admin_bulk_update, #admin_delete, #admin_edit, #admin_index, #admin_json, #admin_json_single, #before_action, #before_before_action, #hashify_query_string, #init_cart, #logged_in?, #logged_in_user, #login_user, #logout_user, #parse_url_params, #reject_param, #user_is_allowed, #user_is_allowed_to, #validate_cookie, #validate_token, #var, #verify_logged_in
Instance Method Details
#admin_edit_general ⇒ Object
GET /admin/store
8 9 10 11 12 |
# File 'app/controllers/caboose/store_controller.rb', line 8 def admin_edit_general return if !user_is_allowed('sites', 'edit') @store_config = @site.store_config @store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil? end |
#admin_edit_packages ⇒ Object
GET /admin/store/packages
36 37 38 39 40 |
# File 'app/controllers/caboose/store_controller.rb', line 36 def admin_edit_packages return if !user_is_allowed('sites', 'edit') @store_config = @site.store_config @store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil? end |
#admin_edit_payment ⇒ Object
GET /admin/store/payment
15 16 17 18 19 |
# File 'app/controllers/caboose/store_controller.rb', line 15 def admin_edit_payment return if !user_is_allowed('sites', 'edit') @store_config = @site.store_config @store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil? end |
#admin_edit_shipping ⇒ Object
GET /admin/store/shipping
22 23 24 25 26 |
# File 'app/controllers/caboose/store_controller.rb', line 22 def admin_edit_shipping return if !user_is_allowed('sites', 'edit') @store_config = @site.store_config @store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil? end |
#admin_edit_tax ⇒ Object
GET /admin/store/tax
29 30 31 32 33 |
# File 'app/controllers/caboose/store_controller.rb', line 29 def admin_edit_tax return if !user_is_allowed('sites', 'edit') @store_config = @site.store_config @store_config = StoreConfig.create(:site_id => @site.id) if @store_config.nil? end |
#admin_update ⇒ Object
PUT /admin/store
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/controllers/caboose/store_controller.rb', line 43 def admin_update return if !user_is_allowed('sites', 'edit') resp = StdClass.new sc = @site.store_config sc = StoreConfig.create(:site_id => @site.id) if sc.nil? save = true params.each do |name,value| case name when 'site_id' then sc.site_id = value when 'pp_name' then sc.pp_name = value when 'pp_username' then sc.pp_username = value when 'pp_password' then sc.pp_password = value when 'pp_testing' then sc.pp_testing = value when 'pp_relay_domain' then sc.pp_relay_domain = value when 'ups_username' then sc.ups_username = value when 'ups_password' then sc.ups_password = value when 'ups_key' then sc.ups_key = value when 'ups_origin_account' then sc.ups_origin_account = value when 'usps_username' then sc.usps_username = value when 'usps_secret_key' then sc.usps_secret_key = value when 'usps_publishable_key' then sc.usps_publishable_key = value when 'fedex_username' then sc.fedex_username = value when 'fedex_password' then sc.fedex_password = value when 'fedex_key' then sc.fedex_key = value when 'fedex_account' then sc.fedex_account = value when 'taxcloud_api_id' then sc.taxcloud_api_id = value when 'taxcloud_api_key' then sc.taxcloud_api_key = value when 'origin_address1' then sc.origin_address1 = value when 'origin_address2' then sc.origin_address2 = value when 'origin_state' then sc.origin_state = value when 'origin_city' then sc.origin_city = value when 'origin_zip' then sc.origin_zip = value when 'origin_country' then sc.origin_country = value when 'fulfillment_email' then sc.fulfillment_email = value when 'shipping_email' then sc.shipping_email = value when 'handling_percentage' then sc.handling_percentage = value when 'auto_calculate_packages' then sc.auto_calculate_packages = value when 'auto_calculate_shipping' then sc.auto_calculate_shipping = value when 'auto_calculate_tax' then sc.auto_calculate_tax = value when 'custom_packages_function' then sc.custom_packages_function = value when 'custom_shipping_function' then sc.custom_shipping_function = value when 'custom_tax_function' then sc.custom_tax_function = value when 'length_unit' then sc.length_unit = value when 'weight_unit' then sc.weight_unit = value when 'download_url_expires_in' then sc.download_url_expires_in = value when 'starting_order_number' then sc.starting_order_number = value end end resp.success = save && sc.save render :json => resp end |
#length_unit_options ⇒ Object
GET /admin/store/length-unit-options
109 110 111 112 113 114 115 116 117 118 119 |
# File 'app/controllers/caboose/store_controller.rb', line 109 def return if !user_is_allowed('sites', 'view') = [ { 'value' => 'in' , 'text' => 'Inches (in)' }, { 'value' => 'ft' , 'text' => 'Feet (ft)' }, { 'value' => 'mm' , 'text' => 'Millimeter (mm)' }, { 'value' => 'cm' , 'text' => 'Centimeter (cm)' }, { 'value' => 'm' , 'text' => 'Meter (m)' } ] render :json => end |
#payment_processor_options ⇒ Object
GET /admin/store/payment-processor-options
99 100 101 102 103 104 105 106 |
# File 'app/controllers/caboose/store_controller.rb', line 99 def return if !user_is_allowed('sites', 'view') = [ { 'value' => 'authorize.net' , 'text' => 'Authorize.net' }, { 'value' => 'stripe' , 'text' => 'Stripe' } ] render :json => end |
#weight_unit_options ⇒ Object
GET /admin/store/weight-unit-options
122 123 124 125 126 127 128 129 130 131 |
# File 'app/controllers/caboose/store_controller.rb', line 122 def return if !user_is_allowed('sites', 'view') = [ { 'value' => 'oz' , 'text' => 'Ounces (oz)' }, { 'value' => 'lb' , 'text' => 'Pounds (lb)' }, { 'value' => 'g' , 'text' => 'Grams (g)' }, { 'value' => 'kg' , 'text' => 'Kilograms (kg)' } ] render :json => end |