36 lines
767 B
Ruby
36 lines
767 B
Ruby
require 'sanitize'
|
|
class ApiPosaCardsController < ApiController
|
|
before_action :api_signed_in_user, :only => [:claim]
|
|
before_action :posa_http_basic_auth, :only => [:activate]
|
|
|
|
#before_action :lookup_review_summary, :only => [:details]
|
|
#before_action :lookup_review, :only => [:update, :delete, :show]
|
|
|
|
respond_to :json
|
|
|
|
# Create a review:
|
|
def activate
|
|
|
|
@posa_card = PosaCard.find_by_code!(params[:code])
|
|
|
|
PosaCard.activate(@posa_card, @retailer)
|
|
|
|
if @posa_card.errors.any?
|
|
respond_with_model(@posa_card)
|
|
return
|
|
end
|
|
end
|
|
|
|
def claim
|
|
@posa_card = PosaCard.find_by_code!(params[:code])
|
|
|
|
@posa_card.claim(current_user)
|
|
|
|
if @posa_card.errors.any?
|
|
respond_with_model(@posa_card)
|
|
return
|
|
end
|
|
end
|
|
|
|
end
|