Class: Spree::Api::BaseController
- Inherits:
- 
      ActionController::Base
      
        - Object
- ActionController::Base
- Spree::Api::BaseController
 
- Includes:
- ControllerSetup, Core::ControllerHelpers::Store, Core::ControllerHelpers::StrongParameters
- Defined in:
- app/controllers/spree/api/base_controller.rb
Direct Known Subclasses
AddressesController, CheckoutsController, ClassificationsController, CountriesController, CreditCardsController, ImagesController, InventoryUnitsController, LineItemsController, OptionTypesController, OptionValuesController, OrdersController, PaymentsController, ProductPropertiesController, ProductsController, PromotionsController, PropertiesController, ReturnAuthorizationsController, ShipmentsController, StatesController, StockItemsController, StockLocationsController, StockMovementsController, StoresController, TaxonomiesController, TaxonsController, UsersController, VariantsController, ZonesController
Instance Attribute Summary collapse
- 
  
    
      #current_api_user  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute current_api_user. 
Instance Method Summary collapse
- #content_type ⇒ Object
- #map_nested_attributes_keys(klass, attributes) ⇒ Object
- 
  
    
      #permitted_line_item_attributes  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    users should be able to set price when importing orders via api. 
Methods included from ControllerSetup
Instance Attribute Details
#current_api_user ⇒ Object
Returns the value of attribute current_api_user.
| 10 11 12 | # File 'app/controllers/spree/api/base_controller.rb', line 10 def current_api_user @current_api_user end | 
Instance Method Details
#content_type ⇒ Object
| 45 46 47 48 49 50 51 52 | # File 'app/controllers/spree/api/base_controller.rb', line 45 def content_type case params[:format] when "json" "application/json; charset=utf-8" when "xml" "text/xml; charset=utf-8" end end | 
#map_nested_attributes_keys(klass, attributes) ⇒ Object
| 27 28 29 30 31 32 33 34 | # File 'app/controllers/spree/api/base_controller.rb', line 27 def map_nested_attributes_keys(klass, attributes) nested_keys = klass..keys attributes.inject({}) do |h, (k,v)| key = nested_keys.include?(k.to_sym) ? "#{k}_attributes" : k h[key] = v h end.with_indifferent_access end | 
#permitted_line_item_attributes ⇒ Object
users should be able to set price when importing orders via api
| 37 38 39 40 41 42 43 | # File 'app/controllers/spree/api/base_controller.rb', line 37 def permitted_line_item_attributes if @current_user_roles.include?("admin") super + [:price, :variant_id, :sku] else super end end |