Sha256: cc7d86f73620977c983c35814346d31ec3fe1456abb0a0a5bd9e3dc34a5911a3
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
require 'json' module ActionTexter module Messagebird class Delivery attr_accessor :body attr_reader :response def initialize(settings) @endpoint = settings[:endpoint] @path = settings[:path] end def deliver message uri = URI.parse( @endpoint ) Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| @response = Response.new(http.post(@path, to_json(message), 'Authorization' => "AccessKey #{ActionTexter.config.product_token}", 'Content-Type' => 'application/json')) end response end def to_json message JSON.generate(recipients: message.to, originator: message.from, body: message.body) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
action-texter-0.2.1.pre | lib/action_texter/provider/messagebird/delivery.rb |