Class: NewsmastMastodon::Api::V1::Accounts::GhostSubscriptionsController
- Inherits:
-
Api::BaseController
- Object
- Api::BaseController
- NewsmastMastodon::Api::V1::Accounts::GhostSubscriptionsController
- Includes:
- Concerns::ApiResponseHelper
- Defined in:
- app/controllers/newsmast_mastodon/api/v1/accounts/ghost_subscriptions_controller.rb
Instance Method Summary collapse
-
#manage_subscription ⇒ Object
manage email subscription to Ghost Site.
Instance Method Details
#manage_subscription ⇒ Object
manage email subscription to Ghost Site
11 12 13 14 15 16 17 18 |
# File 'app/controllers/newsmast_mastodon/api/v1/accounts/ghost_subscriptions_controller.rb', line 11 def manage_subscription email = subscription_params[:email] is_subscribe = ActiveModel::Type::Boolean.new.cast(subscription_params[:subscribe]) member = find_member_by_email(email) member ? update_member_subscribe(member['id'], is_subscribe) : create_ghost_member(email, is_subscribe) rescue => e render_errors(e., :internal_server_error) end |