Class: Toot::SubscriptionsService
- Inherits:
-
Object
- Object
- Toot::SubscriptionsService
- Defined in:
- lib/toot/subscriptions_service.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(env) ⇒ Object
20 21 22 |
# File 'lib/toot/subscriptions_service.rb', line 20 def self.call(env) new.call(env) end |
Instance Method Details
#call(env) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/toot/subscriptions_service.rb', line 4 def call(env) request = Rack::Request.new(env) response = Rack::Response.new json = parse_body_json(request) if json["channel"] && json["callback_url"] Toot.redis do |r| r.sadd json["channel"], json["callback_url"] end else response.status = 422 end response.finish end |