Module: SmsKit::HTTP
- Included in:
- Provider
- Defined in:
- lib/sms_kit/http.rb
Instance Method Summary collapse
Instance Method Details
#connection ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/sms_kit/http.rb', line 18 def connection @conn ||= Faraday.new "#{uri.scheme}://#{uri.host}", ssl: { verify: true } 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) ⇒ Object
14 15 16 |
# File 'lib/sms_kit/http.rb', line 14 def get data connection.get uri.path, data end |
#post(data) ⇒ Object
10 11 12 |
# File 'lib/sms_kit/http.rb', line 10 def post data connection.post uri.path, data end |
#uri ⇒ Object
6 7 8 |
# File 'lib/sms_kit/http.rb', line 6 def uri @uri ||= URI.parse self.class.const_get 'HTTP_ENDPOINT' end |