class MessagebirdTexter::Request
Attributes
body[RW]
response[R]
Public Class Methods
new(body)
click to toggle source
# File lib/messagebird_texter/request.rb, line 9 def initialize(body) @body = body @endpoint = MessagebirdTexter.config.endpoint @path = MessagebirdTexter.config.path @api_key = MessagebirdTexter.config.product_token end
Public Instance Methods
perform()
click to toggle source
# File lib/messagebird_texter/request.rb, line 16 def perform 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