Class: Twi::Lio
- Inherits:
-
Object
- Object
- Twi::Lio
- Defined in:
- lib/twi/lio.rb
Overview
Provides an object to store global configuration settings.
This class is not used directly, but by calling Twi.configure, which creates and updates a single instance of Lio.
An alternative way to set global configuration settings is by storing them in the following environment variables:
-
TWILIO_SIDto store the Twilio SID -
TWILIO_SECRETto store the Twilio secret -
TWILIO_CONVERSATION_SERVICE_SIDto store the Twilio Conversation service ID
In case both methods are used together, Twi.configure takes precedence.
Instance Attribute Summary collapse
-
#account_sid ⇒ String
readonly
Account SID - used for advanced operations like creating numbers.
-
#api_key ⇒ String
readonly
API key - used for basic operations like sending messages.
-
#auth_token ⇒ String
readonly
OAuth token - to authenticate API requests made with
account_sid. -
#conversation_sid ⇒ String
readonly
The SID of the default Conversation service.
-
#emergency_address_sid ⇒ String
readonly
The SID of the emergency address.
-
#messaging_sid ⇒ String
readonly
The SID of the default Messaging service.
-
#secret ⇒ String
readonly
Secret - to authenticate API requests made with
api_key.
Instance Method Summary collapse
-
#initialize ⇒ Lio
constructor
Initialize the global configuration settings defaulting to matching environment variables.
Constructor Details
#initialize ⇒ Lio
Initialize the global configuration settings defaulting to matching environment variables.
32 33 34 35 36 37 38 39 40 |
# File 'lib/twi/lio.rb', line 32 def initialize @api_key = ENV['TWILIO_SID'] @secret = ENV['TWILIO_SECRET'] @account_sid = ENV['TWILIO_ACCOUNT_SID'] @auth_token = ENV['TWILIO_AUTH_TOKEN'] @conversation_sid = ENV['TWILIO_CONVERSATION_SERVICE_SID'] @messaging_sid = ENV['TWILIO_MESSAGING_SID'] @emergency_address_sid = ENV['TWILIO_EMERGENCY_SID'] end |
Instance Attribute Details
#account_sid ⇒ String (readonly)
Returns Account SID - used for advanced operations like creating numbers.
49 50 51 |
# File 'lib/twi/lio.rb', line 49 def account_sid @account_sid end |
#api_key ⇒ String (readonly)
Returns API key - used for basic operations like sending messages.
43 44 45 |
# File 'lib/twi/lio.rb', line 43 def api_key @api_key end |
#auth_token ⇒ String (readonly)
Returns OAuth token - to authenticate API requests made with account_sid.
52 53 54 |
# File 'lib/twi/lio.rb', line 52 def auth_token @auth_token end |
#conversation_sid ⇒ String (readonly)
Returns the SID of the default Conversation service.
55 56 57 |
# File 'lib/twi/lio.rb', line 55 def conversation_sid @conversation_sid end |
#emergency_address_sid ⇒ String (readonly)
Returns the SID of the emergency address.
61 62 63 |
# File 'lib/twi/lio.rb', line 61 def emergency_address_sid @emergency_address_sid end |
#messaging_sid ⇒ String (readonly)
Returns the SID of the default Messaging service.
58 59 60 |
# File 'lib/twi/lio.rb', line 58 def messaging_sid @messaging_sid end |
#secret ⇒ String (readonly)
Returns secret - to authenticate API requests made with api_key.
46 47 48 |
# File 'lib/twi/lio.rb', line 46 def secret @secret end |