Sha256: 98bffaefeaa5c1f110fa957366b8156c56e7cd0fb10b190c3ecc008897a8f2e3
Contents?: true
Size: 831 Bytes
Versions: 1
Compression:
Stored size: 831 Bytes
Contents
require 'messagebird_texter/response' require 'messagebird_texter/validator/request' module MessagebirdTexter class Request < ActionTexter::Request attr_accessor :body attr_reader :response def initialize(body) @body = body @endpoint = MessagebirdTexter.config.endpoint @path = MessagebirdTexter.config.path @api_key = MessagebirdTexter.config.product_token end def perform return unless valid? uri = URI.parse(@endpoint) Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| @response = Response.new(http.post(@path, body, 'Authorization' => "AccessKey #{@api_key}", 'Content-Type' => 'application/json')) end response end def valid? MessagebirdTexter::Validator::Request.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
messagebird-texter-0.0.2 | lib/messagebird_texter/request.rb |