Class: AfTalk::Connection
- Inherits:
-
Object
- Object
- AfTalk::Connection
- Defined in:
- lib/aftalk/connection.rb
Constant Summary collapse
- URL =
"https://api.africastalking.com".freeze
- SANDBOX_URL =
"https://api.sandbox.africastalking.com".freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build ⇒ Object
9 10 11 |
# File 'lib/aftalk/connection.rb', line 9 def self.build @_connection ||= new.build end |
.clear ⇒ Object
13 14 15 |
# File 'lib/aftalk/connection.rb', line 13 def self.clear @_connection = nil end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/aftalk/connection.rb', line 17 def build Faraday.new( url: api_url, headers: { apiKey: AfTalk::Configuration.api_key, accept: "application/json" }, ) do |connection| connection.request :url_encoded connection.response :json, content_type: /\bjson$/, parser_options: { symbolize_names: true } connection.adapter Faraday.default_adapter end end |