Class: Twilio::REST::Domain

Inherits:
Object
  • Object
show all
Defined in:
lib/twilio-ruby/framework/rest/domain.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Domain

Returns a new instance of Domain.


8
9
10
11
12
13
# File 'lib/twilio-ruby/framework/rest/domain.rb', line 8

def initialize(client)
  @client = client
  @host = nil
  @base_url = nil
  @port = nil
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client


6
7
8
# File 'lib/twilio-ruby/framework/rest/domain.rb', line 6

def client
  @client
end

Instance Method Details

#absolute_url(uri) ⇒ Object


15
16
17
# File 'lib/twilio-ruby/framework/rest/domain.rb', line 15

def absolute_url(uri)
  "#{@base_url.chomp('/')}/#{uri.chomp('/').gsub(/^\//, '')}"
end

#request(method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil) ⇒ Object


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/twilio-ruby/framework/rest/domain.rb', line 19

def request(method, uri, params = {}, data = {}, headers = {}, auth = nil, timeout = nil)
  url = uri.match(/^http/) ? uri : absolute_url(uri)

  @client.request(
    @base_url,
    @port,
    method,
    url,
    params,
    data,
    headers,
    auth,
    timeout
  )
end