module SmsKit::HTTP
Constants
- USER_AGENT
Public Instance Methods
connection() { |f| ... }
click to toggle source
# File lib/sms_kit/http.rb, line 20 def connection if 'https' != uri.scheme warn "[SmsKit] Provider '#{self.class.name}' is using an unencrypted connection: #{uri}" end @conn ||= Faraday.new "#{uri.scheme}://#{uri.host}" do |f| f.headers[:user_agent] = USER_AGENT f.response :logger, SmsKit.logger f.adapter Faraday.default_adapter yield f if block_given? end end
get(data)
click to toggle source
# File lib/sms_kit/http.rb, line 16 def get data connection.get uri.path, data end
post(data)
click to toggle source
# File lib/sms_kit/http.rb, line 12 def post data connection.post uri.path, data end
uri()
click to toggle source
# File lib/sms_kit/http.rb, line 8 def uri @uri ||= URI.parse self.class.const_get 'HTTP_ENDPOINT' end