Class: Spree::Api::V3::Store::CountriesController
- Inherits:
-
Store::BaseController
- Object
- Store::BaseController
- Spree::Api::V3::Store::CountriesController
- Includes:
- HttpCaching
- Defined in:
- app/controllers/spree/api/v3/store/countries_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /api/v3/store/countries.
-
#show ⇒ Object
GET /api/v3/store/countries/:id.
Instance Method Details
#index ⇒ Object
GET /api/v3/store/countries
9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/spree/api/v3/store/countries_controller.rb', line 9 def index countries = current_store.countries_from_markets return unless cache_collection(countries) render json: { data: countries.map { |country| serialize_country(country) } } end |
#show ⇒ Object
GET /api/v3/store/countries/:id
20 21 22 23 24 25 26 |
# File 'app/controllers/spree/api/v3/store/countries_controller.rb', line 20 def show country = current_store.countries_from_markets.find_by!(iso: params[:id].upcase) return unless cache_resource(country) render json: serialize_country(country) end |