Class: Restcomm::REST::BaseClient
- Inherits:
-
Object
- Object
- Restcomm::REST::BaseClient
- Defined in:
- lib/restcomm-ruby/rest/client.rb
Direct Known Subclasses
Constant Summary collapse
- HTTP_HEADERS =
{ 'Accept' => 'application/json', 'Accept-Charset' => 'utf-8', 'User-Agent' => "restcomm-ruby/#{Restcomm::VERSION}" \ " (#{RUBY_ENGINE}/#{RUBY_PLATFORM}" \ " #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL})" }
- DEFAULTS =
{ host: '', port: 8080, use_ssl: false, ssl_verify_peer: false, ssl_ca_file: File.dirname(__FILE__) + '/../../../conf/cacert.pem', timeout: 30, proxy_addr: nil, proxy_port: nil, proxy_user: nil, proxy_pass: nil, retry_limit: 1 }
Instance Attribute Summary collapse
-
#account_sid ⇒ Object
readonly
Returns the value of attribute account_sid.
-
#last_request ⇒ Object
readonly
Returns the value of attribute last_request.
-
#last_response ⇒ Object
readonly
Returns the value of attribute last_response.
Instance Method Summary collapse
-
#initialize(*args) ⇒ BaseClient
constructor
A new instance of BaseClient.
Methods included from Utils
Methods included from Util
Constructor Details
#initialize(*args) ⇒ BaseClient
Returns a new instance of BaseClient.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/restcomm-ruby/rest/client.rb', line 25 def initialize(*args) = args.last.is_a?(Hash) ? args.pop : {host: args[2]} @config = get_defaults.merge! @account_sid = args[0] || Restcomm.account_sid @auth_token = args[1] || Restcomm.auth_token @host=args[2] if @account_sid.nil? || @auth_token.nil? raise ArgumentError, 'Account SID and auth token are required' end if @host.nil? raise ArgumentError, 'Destination Host IP cannot is required!' end set_up_connection set_up_subresources end |
Instance Attribute Details
#account_sid ⇒ Object (readonly)
Returns the value of attribute account_sid.
19 20 21 |
# File 'lib/restcomm-ruby/rest/client.rb', line 19 def account_sid @account_sid end |
#last_request ⇒ Object (readonly)
Returns the value of attribute last_request.
19 20 21 |
# File 'lib/restcomm-ruby/rest/client.rb', line 19 def last_request @last_request end |
#last_response ⇒ Object (readonly)
Returns the value of attribute last_response.
19 20 21 |
# File 'lib/restcomm-ruby/rest/client.rb', line 19 def last_response @last_response end |