Sha256: 8c79464363662534afc653cb6b3476f34c8eb867f9281fe51f088d09d94e229d

Contents?: true

Size: 527 Bytes

Versions: 8

Compression:

Stored size: 527 Bytes

Contents

module Spree
  module Api
    module V2
      class CountriesController < Spree::Api::V2::BaseController
        skip_before_action :authenticate_user, only: [:index, :show]

        def index
          render_collection Spree::Country.includes(:states)
        end

        def show
          if params[:state_id].present?
            render_instance Spree::State.find_country(params[:state_id])
          else
            render_instance Spree::Country.find(params[:id])
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 app/controllers/spree/api/v2/countries_controller.rb
solidus_json_api-0.3.0 app/controllers/spree/api/v2/countries_controller.rb
spree_api_v2-0.2.2 app/controllers/spree/api/v2/countries_controller.rb
solidus_api_v2-0.2.2 app/controllers/spree/api/v2/countries_controller.rb
solidus_api_v2-0.2.1 app/controllers/spree/api/v2/countries_controller.rb
spree_api_v2-0.2.1 app/controllers/spree/api/v2/countries_controller.rb
spree_api_v2-0.2.0 app/controllers/spree/api/v2/countries_controller.rb
solidus_api_v2-0.2.0 app/controllers/spree/api/v2/countries_controller.rb