Class: Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::SipList::CredentialListContext
- 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
-
#credentials(sid = :unset) ⇒ CredentialList, CredentialContext
Access the credentials.
-
#delete ⇒ Boolean
Delete the CredentialListInstance.
-
#fetch ⇒ CredentialListInstance
Fetch the CredentialListInstance.
-
#initialize(version, account_sid, sid) ⇒ CredentialListContext
constructor
Initialize the CredentialListContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: nil) ⇒ CredentialListInstance
Update the CredentialListInstance.
Constructor Details
#initialize(version, account_sid, sid) ⇒ CredentialListContext
Initialize the CredentialListContext
166 167 168 169 170 171 172 173 174 175 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 166 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: 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
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 239 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 |
#delete ⇒ Boolean
Delete the CredentialListInstance
179 180 181 182 183 184 185 186 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 179 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ CredentialListInstance
Fetch the CredentialListInstance
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 191 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) CredentialListInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
264 265 266 267 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 264 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CredentialListContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
257 258 259 260 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 257 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
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/twilio-ruby/rest/api/v2010/account/sip/credential_list.rb', line 212 def update( friendly_name: nil ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) CredentialListInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |