Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb,
lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb

Defined Under Namespace

Classes: CredentialContext, CredentialInstance, CredentialList, CredentialPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, sid) ⇒ CredentialListContext

Initialize the CredentialListContext



157
158
159
160
161
162
163
164
165
166
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 157

def initialize(version, , sid)
    super(version)

    # Path Solution
    @solution = { account_sid: , sid: sid,  }
    @uri = "/Accounts/#{@solution[:account_sid]}/SIP/CredentialLists/#{@solution[:sid]}.json"

    # Dependents
    @credentials = nil
end

Instance Method Details

#credentials(sid = :unset) ⇒ CredentialList, CredentialContext

Access the credentials

Raises:

  • (ArgumentError)


214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 214

def credentials(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return CredentialContext.new(@version, @solution[:account_sid], @solution[:sid],sid )
    end

    unless @credentials
        @credentials = CredentialList.new(
            @version, account_sid: @solution[:account_sid],  credential_list_sid: @solution[:sid],  )
    end

 @credentials
end

#deleteBoolean

Delete the CredentialListInstance



170
171
172
173
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 170

def delete

    @version.delete('DELETE', @uri)
end

#fetchCredentialListInstance

Fetch the CredentialListInstance



178
179
180
181
182
183
184
185
186
187
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 178

def fetch

    payload = @version.fetch('GET', @uri)
    CredentialListInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



239
240
241
242
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 239

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.CredentialListContext #{context}>"
end

#to_sObject

Provide a user friendly representation



232
233
234
235
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 232

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.CredentialListContext #{context}>"
end

#update(friendly_name: nil) ⇒ CredentialListInstance

Update the CredentialListInstance



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 193

def update(
    friendly_name: nil
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
    })

    payload = @version.update('POST', @uri, data: data)
    CredentialListInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        sid: @solution[:sid],
    )
end