Class: Bandwidth::WebRtc::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bandwidth/web_rtc_lib/web_rtc/client.rb

Overview

bandwidth client class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeout: 60, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put get put], environment: Environment::PRODUCTION, base_url: 'https://www.example.com', messaging_basic_auth_user_name: 'TODO: Replace', messaging_basic_auth_password: 'TODO: Replace', multi_factor_auth_basic_auth_user_name: 'TODO: Replace', multi_factor_auth_basic_auth_password: 'TODO: Replace', phone_number_lookup_basic_auth_user_name: 'TODO: Replace', phone_number_lookup_basic_auth_password: 'TODO: Replace', voice_basic_auth_user_name: 'TODO: Replace', voice_basic_auth_password: 'TODO: Replace', web_rtc_basic_auth_user_name: 'TODO: Replace', web_rtc_basic_auth_password: 'TODO: Replace', config: nil) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/bandwidth/web_rtc_lib/web_rtc/client.rb', line 18

def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
               backoff_factor: 2,
               retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
               retry_methods: %i[get put get put],
               environment: Environment::PRODUCTION,
               base_url: 'https://www.example.com',
               messaging_basic_auth_user_name: 'TODO: Replace',
               messaging_basic_auth_password: 'TODO: Replace',
               multi_factor_auth_basic_auth_user_name: 'TODO: Replace',
               multi_factor_auth_basic_auth_password: 'TODO: Replace',
               phone_number_lookup_basic_auth_user_name: 'TODO: Replace',
               phone_number_lookup_basic_auth_password: 'TODO: Replace',
               voice_basic_auth_user_name: 'TODO: Replace',
               voice_basic_auth_password: 'TODO: Replace',
               web_rtc_basic_auth_user_name: 'TODO: Replace',
               web_rtc_basic_auth_password: 'TODO: Replace',
               config: nil)
  @config = if config.nil?
              Configuration.new(timeout: timeout,
                                max_retries: max_retries,
                                retry_interval: retry_interval,
                                backoff_factor: backoff_factor,
                                retry_statuses: retry_statuses,
                                retry_methods: retry_methods,
                                environment: environment,
                                base_url: base_url,
                                messaging_basic_auth_user_name: messaging_basic_auth_user_name,
                                messaging_basic_auth_password: messaging_basic_auth_password,
                                multi_factor_auth_basic_auth_user_name: multi_factor_auth_basic_auth_user_name,
                                multi_factor_auth_basic_auth_password: multi_factor_auth_basic_auth_password,
                                phone_number_lookup_basic_auth_user_name: phone_number_lookup_basic_auth_user_name,
                                phone_number_lookup_basic_auth_password: phone_number_lookup_basic_auth_password,
                                voice_basic_auth_user_name: voice_basic_auth_user_name,
                                voice_basic_auth_password: voice_basic_auth_password,
                                web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
                                web_rtc_basic_auth_password: web_rtc_basic_auth_password)
            else
              config
            end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/bandwidth/web_rtc_lib/web_rtc/client.rb', line 10

def config
  @config
end

Instance Method Details

#clientAPIController

Access to client controller.

Returns:



14
15
16
# File 'lib/bandwidth/web_rtc_lib/web_rtc/client.rb', line 14

def client
  @client ||= APIController.new config
end