Sha256: d880b8821622fcdeb057ccf16e805610214f589aad9bf25dc15aa0fcdfe610e4
Contents?: true
Size: 902 Bytes
Versions: 1
Compression:
Stored size: 902 Bytes
Contents
# frozen_string_literal: true require 'faraday' require 'json' require_relative 'response' require_relative '../client' module WaCloudApi module Message class Client < WaCloudApi::Client def self.deliver(params:) response = new.deliver(params) Response.new(response.status, response.body) end def deliver(params) super conn.post do |req| req.body = params.to_json end end private def url "https://graph.facebook.com/v18.0/#{WaCloudApi.configuration.phone_number_id}/messages" end def conn @conn ||= Faraday.new(url: url) do |faraday| faraday.adapter Faraday.default_adapter faraday.headers['Authorization'] = "Bearer #{WaCloudApi.configuration.token}" faraday.headers['Content-Type'] = 'application/json' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wa_cloud_api-0.1.1 | lib/wa_cloud_api/message/client.rb |