Class: Spree::Api::BaseController
- Inherits:
-
ActionController::Metal
- Object
- ActionController::Metal
- Spree::Api::BaseController
- Includes:
- ActionController::Head, ControllerSetup
- Defined in:
- app/controllers/spree/api/base_controller.rb
Direct Known Subclasses
AddressesController, CheckoutsController, CountriesController, ImagesController, InventoryUnitsController, LineItemsController, OrdersController, PaymentsController, ProductPropertiesController, ProductsController, ReturnAuthorizationsController, ShipmentsController, 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
Methods included from ControllerSetup
Instance Attribute Details
#current_api_user ⇒ Object
Returns the value of attribute current_api_user.
9 10 11 |
# File 'app/controllers/spree/api/base_controller.rb', line 9 def current_api_user @current_api_user end |
Instance Method Details
#map_nested_attributes_keys(klass, attributes) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/controllers/spree/api/base_controller.rb', line 31 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 |
#set_jsonp_format ⇒ Object
24 25 26 27 28 29 |
# File 'app/controllers/spree/api/base_controller.rb', line 24 def set_jsonp_format if params[:callback] && request.get? self.response_body = "#{params[:callback]}(#{self.response_body})" headers["Content-Type"] = 'application/javascript' end end |