Class: Infobip::SmsApi::Configuration
- Inherits:
-
Object
- Object
- Infobip::SmsApi::Configuration
- Defined in:
- lib/infobip/sms_api/configuration.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #connect ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 |
# File 'lib/infobip/sms_api/configuration.rb', line 6 def initialize @endpoint = 'https://api.infobip.com' @debug = false end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
4 5 6 |
# File 'lib/infobip/sms_api/configuration.rb', line 4 def connection @connection end |
#debug ⇒ Object
Returns the value of attribute debug.
4 5 6 |
# File 'lib/infobip/sms_api/configuration.rb', line 4 def debug @debug end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
4 5 6 |
# File 'lib/infobip/sms_api/configuration.rb', line 4 def endpoint @endpoint end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/infobip/sms_api/configuration.rb', line 4 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/infobip/sms_api/configuration.rb', line 4 def username @username end |
Instance Method Details
#connect ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/infobip/sms_api/configuration.rb', line 11 def connect raise 'Username and/or password are not configured' unless @username && @password @connection = Faraday.new(url: @endpoint) do |faraday| faraday.adapter :net_http faraday.response :logger if @debug end @connection.basic_auth @username, @password end |