Class: SolidusSubscriptions::Api::V1::SubscriptionsController

Inherits:
Spree::Api::BaseController
  • Object
show all
Defined in:
app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb

Instance Method Summary collapse

Instance Method Details

#cancelObject


22
23
24
25
26
27
28
# File 'app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb', line 22

def cancel
  if @subscription.cancel
    render json: @subscription.to_json
  else
    render json: @subscription.errors.to_json, status: 422
  end
end

#skipObject


14
15
16
17
18
19
20
# File 'app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb', line 14

def skip
  if @subscription.skip
    render json: @subscription.to_json
  else
    render json: @subscription.errors.to_json, status: 422
  end
end

#updateObject


6
7
8
9
10
11
12
# File 'app/controllers/solidus_subscriptions/api/v1/subscriptions_controller.rb', line 6

def update
  if @subscription.update(subscription_params)
    render json: @subscription.to_json(include: [:line_items, :shipping_address])
  else
    render json: @subscription.errors.to_json, status: 422
  end
end