Exchange XMPP contacts when invitee signs up
This commit is contained in:
20
app/services/ejabberd_api_client.rb
Normal file
20
app/services/ejabberd_api_client.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class EjabberdApiClient
|
||||
def initialize
|
||||
@base_url = ENV["EJABBERD_API_URL"]
|
||||
end
|
||||
|
||||
def post(endpoint, payload)
|
||||
res = Faraday.post("#{@base_url}/#{endpoint}", payload,
|
||||
"Content-Type" => "application/json")
|
||||
|
||||
if res.status != 200
|
||||
Rails.logger.error "[ejabberd] API request failed:"
|
||||
Rails.logger.error res.body
|
||||
#TODO add some kind of exception tracking/notifications
|
||||
end
|
||||
end
|
||||
|
||||
def add_rosteritem(payload)
|
||||
post "add_rosteritem", payload
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user