Class: VoiceML::Client
- Inherits:
-
Object
- Object
- VoiceML::Client
- Defined in:
- lib/voiceml/client.rb
Overview
Synchronous client for the VoiceML REST API.
VoiceML uses HTTP Basic auth: the ‘account_sid` (Twilio-format `AC` + 32 hex) is the username and `api_key` is the password. Drop-in compatible with the Twilio Ruby SDK constructor signature.
Instance Attribute Summary collapse
-
#applications ⇒ Object
readonly
Returns the value of attribute applications.
-
#calls ⇒ Object
readonly
Returns the value of attribute calls.
-
#conferences ⇒ Object
readonly
Returns the value of attribute conferences.
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#incoming_phone_numbers ⇒ Object
readonly
Returns the value of attribute incoming_phone_numbers.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#notifications ⇒ Object
readonly
Returns the value of attribute notifications.
-
#queues ⇒ Object
readonly
Returns the value of attribute queues.
-
#recordings ⇒ Object
readonly
Returns the value of attribute recordings.
Instance Method Summary collapse
- #account_sid ⇒ Object
- #base_url ⇒ Object
-
#initialize(account_sid:, api_key: nil, auth_token: nil, base_url: Transport::DEFAULT_BASE_URL, timeout: Transport::DEFAULT_TIMEOUT, max_retries: Transport::DEFAULT_MAX_RETRIES, user_agent: nil, http_client: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(account_sid:, api_key: nil, auth_token: nil, base_url: Transport::DEFAULT_BASE_URL, timeout: Transport::DEFAULT_TIMEOUT, max_retries: Transport::DEFAULT_MAX_RETRIES, user_agent: nil, http_client: nil) ⇒ Client
Returns a new instance of Client.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/voiceml/client.rb', line 43 def initialize(account_sid:, api_key: nil, auth_token: nil, base_url: Transport::DEFAULT_BASE_URL, timeout: Transport::DEFAULT_TIMEOUT, max_retries: Transport::DEFAULT_MAX_RETRIES, user_agent: nil, http_client: nil) if !api_key.nil? && !auth_token.nil? raise ArgumentError, 'pass either api_key: or auth_token:, not both' end resolved_key = api_key || auth_token @transport = Transport.new( account_sid: account_sid, api_key: resolved_key, base_url: base_url, timeout: timeout, max_retries: max_retries, user_agent: user_agent, http_client: http_client ) @calls = CallsResource.new(@transport) @conferences = ConferencesResource.new(@transport) @queues = QueuesResource.new(@transport) @applications = ApplicationsResource.new(@transport) @recordings = RecordingsResource.new(@transport) @incoming_phone_numbers = IncomingPhoneNumbersResource.new(@transport) @notifications = NotificationsResource.new(@transport) @diagnostics = DiagnosticsResource.new(@transport) @messages = MessagesResource.new(@transport) end |
Instance Attribute Details
#applications ⇒ Object (readonly)
Returns the value of attribute applications.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def applications @applications end |
#calls ⇒ Object (readonly)
Returns the value of attribute calls.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def calls @calls end |
#conferences ⇒ Object (readonly)
Returns the value of attribute conferences.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def conferences @conferences end |
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def diagnostics @diagnostics end |
#incoming_phone_numbers ⇒ Object (readonly)
Returns the value of attribute incoming_phone_numbers.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def incoming_phone_numbers @incoming_phone_numbers end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def @messages end |
#notifications ⇒ Object (readonly)
Returns the value of attribute notifications.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def notifications @notifications end |
#queues ⇒ Object (readonly)
Returns the value of attribute queues.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def queues @queues end |
#recordings ⇒ Object (readonly)
Returns the value of attribute recordings.
30 31 32 |
# File 'lib/voiceml/client.rb', line 30 def recordings @recordings end |
Instance Method Details
#account_sid ⇒ Object
75 76 77 |
# File 'lib/voiceml/client.rb', line 75 def account_sid @transport.account_sid end |
#base_url ⇒ Object
79 80 81 |
# File 'lib/voiceml/client.rb', line 79 def base_url @transport.base_url end |