Class: Moonshot::Convertkit::UnsubscribeJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Moonshot::Convertkit::UnsubscribeJob
- Defined in:
- app/jobs/moonshot/convertkit/unsubscribe_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(email) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/jobs/moonshot/convertkit/unsubscribe_job.rb', line 10 def perform email return unless Rails.env.production? assert_required_config! Excon .put( 'https://api.convertkit.com/v3/unsubscribe', body: { email: email, api_secret: convertkit_api_secret }.to_json, headers: { 'Content-Type' => 'application/json' } ).then { |response| JSON.parse(response.body) } end |