Class: Twilio::REST::Routes::V2::SipDomainInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/routes/v2/sip_domain.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sip_domain: nil) ⇒ SipDomainInstance

Initialize the SipDomainInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this SipDomain resource.

  • sid (String)

    The SID of the Call resource to fetch.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 160

def initialize(version, payload , sip_domain: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sip_domain' => payload['sip_domain'],
        'url' => payload['url'],
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'voice_region' => payload['voice_region'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

    # Context
    @instance_context = nil
    @params = { 'sip_domain' => sip_domain  || @properties['sip_domain']  , }
end

Instance Method Details

#account_sidString

Returns:

  • (String)


211
212
213
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 211

def 
    @properties['account_sid']
end

#contextSipDomainContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



184
185
186
187
188
189
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 184

def context
    unless @instance_context
        @instance_context = SipDomainContext.new(@version , @params['sip_domain'])
    end
    @instance_context
end

#date_createdTime

Returns:

  • (Time)


229
230
231
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 229

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns:

  • (Time)


235
236
237
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 235

def date_updated
    @properties['date_updated']
end

#fetchSipDomainInstance

Fetch the SipDomainInstance

Returns:



242
243
244
245
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 242

def fetch

    context.fetch
end

#friendly_nameString

Returns:

  • (String)


217
218
219
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 217

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



272
273
274
275
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 272

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Routes.V2.SipDomainInstance #{values}>"
end

#sidString

Returns:

  • (String)


205
206
207
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 205

def sid
    @properties['sid']
end

#sip_domainString

Returns:

  • (String)


193
194
195
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 193

def sip_domain
    @properties['sip_domain']
end

#to_sObject

Provide a user friendly representation



265
266
267
268
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 265

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Routes.V2.SipDomainInstance #{values}>"
end

#update(voice_region: :unset, friendly_name: :unset) ⇒ SipDomainInstance

Update the SipDomainInstance

Parameters:

  • voice_region (String) (defaults to: :unset)
  • friendly_name (String) (defaults to: :unset)

Returns:



252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 252

def update(
    voice_region: :unset, 
    friendly_name: :unset
)

    context.update(
        voice_region: voice_region, 
        friendly_name: friendly_name, 
    )
end

#urlString

Returns:

  • (String)


199
200
201
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 199

def url
    @properties['url']
end

#voice_regionString

Returns:

  • (String)


223
224
225
# File 'lib/twilio-ruby/rest/routes/v2/sip_domain.rb', line 223

def voice_region
    @properties['voice_region']
end