Class: NewsmastMastodon::BoostLamdaNewsmastService

Inherits:
Object
  • Object
show all
Defined in:
app/services/newsmast_mastodon/boost_lamda_newsmast_service.rb

Instance Method Summary collapse

Constructor Details

#initializeBoostLamdaNewsmastService

Returns a new instance of BoostLamdaNewsmastService.



9
10
11
12
# File 'app/services/newsmast_mastodon/boost_lamda_newsmast_service.rb', line 9

def initialize
  @base_url = ENV.fetch('BOOST_COMMUNITY_BOT_URL', nil)
  @api_key = ENV.fetch('BOOST_COMMUNITY_BOT_API_KEY', nil)
end

Instance Method Details

#boost_status(post_bot_account, post_id, post_url) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/newsmast_mastodon/boost_lamda_newsmast_service.rb', line 14

def boost_status(, post_id, post_url)
  HTTParty.post(@base_url,
                body: {
                  body: {
                    post_bot: ,
                    post_id: post_id,
                    post_url: post_url.gsub(/\s+/, ''),
                  },
                }.to_json,
                headers: { 'Content-Type' => 'application/json',
                           'x-api-key' => @api_key })
end