Class: Spree::Api::BaseController
- Inherits:
- 
      ActionController::Metal
      
        - Object
- ActionController::Metal
- Spree::Api::BaseController
 
- Includes:
- ActionController::ConditionalGet, ActionController::Head, ActionController::StrongParameters, ControllerSetup, Core::ControllerHelpers::SSL, Core::ControllerHelpers::StrongParameters
- Defined in:
- app/controllers/spree/api/base_controller.rb
Direct Known Subclasses
AddressesController, CheckoutsController, ConfigController, CountriesController, ImagesController, InventoryUnitsController, LineItemsController, OptionTypesController, OptionValuesController, OrdersController, PaymentsController, ProductPropertiesController, ProductsController, PropertiesController, ReturnAuthorizationsController, ShipmentsController, StatesController, StockItemsController, StockLocationsController, StockMovementsController, 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
- #map_nested_attributes_keys(klass, attributes) ⇒ Object
- 
  
    
      #permitted_line_item_attributes  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    users should be able to set price when importing orders via api. 
- #set_jsonp_format ⇒ Object
Methods included from ControllerSetup
Instance Attribute Details
#current_api_user ⇒ Object
Returns the value of attribute current_api_user.
| 17 18 19 | # File 'app/controllers/spree/api/base_controller.rb', line 17 def current_api_user @current_api_user end | 
Instance Method Details
#map_nested_attributes_keys(klass, attributes) ⇒ Object
| 39 40 41 42 43 44 45 46 | # File 'app/controllers/spree/api/base_controller.rb', line 39 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
| 49 50 51 52 53 54 55 | # File 'app/controllers/spree/api/base_controller.rb', line 49 def permitted_line_item_attributes if current_api_user.has_spree_role?("admin") super << [:price, :variant_id, :sku] else super end end | 
#set_jsonp_format ⇒ Object
| 32 33 34 35 36 37 | # File 'app/controllers/spree/api/base_controller.rb', line 32 def set_jsonp_format if params[:callback] && request.get? self.response_body = "#{params[:callback]}(#{self.response_body})" headers["Content-Type"] = 'application/javascript' end end |