Sha256: b89d8a050ba801bff348fd9049a71d267da4d7e654a6c5322b73245abda776e7
Contents?: true
Size: 946 Bytes
Versions: 12
Compression:
Stored size: 946 Bytes
Contents
require 'cm_sms/response' module CmSms class Request attr_accessor :body attr_reader :response def initialize(body) @body = body @endpoint = CmSms.config.endpoint @path = CmSms.config.path end def perform raise CmSms::Configuration::EndpointMissing.new("Please provide an valid api endpoint.\nIf you leave this config blank, the default will be set to https://sgw01.cm.nl.") if @endpoint.nil? || @endpoint.empty? raise CmSms::Configuration::PathMissing.new("Please provide an valid api path.\nIf you leave this config blank, the default will be set to /gateway.ashx.") if @path.nil? || @path.empty? 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, initheader = { 'Content-Type' => 'application/xml' })) end response end end end
Version data entries
12 entries across 12 versions & 1 rubygems