Class: Passkit::Api::V1::RegistrationsController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- Passkit::Api::V1::RegistrationsController
- Defined in:
- app/controllers/passkit/api/v1/registrations_controller.rb
Overview
TODO: check with authentication_token This Class Implements the Apple PassKit API
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/passkit/api/v1/registrations_controller.rb', line 16 def create if @pass.devices.find_by(identifier: params[:device_id]) render json: {}, status: :ok return end register_device render json: {}, status: :created end |
#destroy ⇒ Object
50 51 52 53 54 |
# File 'app/controllers/passkit/api/v1/registrations_controller.rb', line 50 def destroy registrations = @pass.registrations.where(passkit_device_id: params[:device_id]) registrations.delete_all render json: {}, status: :ok end |
#show ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/passkit/api/v1/registrations_controller.rb', line 32 def show if @device.nil? render json: {}, status: :not_found return end passes = fetch_registered_passes if passes.none? render json: {}, status: :no_content return end render json: updatable_passes(passes).to_json end |