Class: NewsmastMastodon::Api::V1::RelaysController

Inherits:
Api::BaseController
  • Object
show all
Defined in:
app/controllers/newsmast_mastodon/api/v1/relays_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/newsmast_mastodon/api/v1/relays_controller.rb', line 8

def create
  @relay = Relay.find_or_initialize_by(relay_params)
  unless @relay.persisted?
    @relay.save
    @relay.enable!
  end

  head 200
end

#destroyObject



18
19
20
21
# File 'app/controllers/newsmast_mastodon/api/v1/relays_controller.rb', line 18

def destroy
  @relay.destroy
  render_empty
end