Sha256: d0bd86331c977b77a301ab5d92d7f7b94f8b31ec2eb9506112c03c07e8a51239
Contents?: true
Size: 897 Bytes
Versions: 1
Compression:
Stored size: 897 Bytes
Contents
require 'json' module ActionTexter module Provider module Messagebird class Delivery attr_accessor :body attr_reader :response def initialize(settings) @endpoint = settings[:endpoint] @path = settings[:path] end def deliver message binding.pry 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
action-texter-0.1.2.ALPHA | lib/action_texter/provider/messagebird/delivery.rb |