Class: Twilio::REST::IpMessaging::V2::CredentialContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/ip_messaging/v2/credential.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CredentialContext

Initialize the CredentialContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)


172
173
174
175
176
177
178
179
180
# File 'lib/twilio-ruby/rest/ip_messaging/v2/credential.rb', line 172

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Credentials/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the CredentialInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchCredentialInstance

Fetch the CredentialInstance

Returns:



194
195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/ip_messaging/v2/credential.rb', line 194

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    payload = @version.fetch('GET', @uri, headers: headers)
    CredentialInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



253
254
255
256
# File 'lib/twilio-ruby/rest/ip_messaging/v2/credential.rb', line 253

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

#to_sObject

Provide a user friendly representation



246
247
248
249
# File 'lib/twilio-ruby/rest/ip_messaging/v2/credential.rb', line 246

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

#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance

Update the CredentialInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)
  • certificate (String) (defaults to: :unset)
  • private_key (String) (defaults to: :unset)
  • sandbox (Boolean) (defaults to: :unset)
  • api_key (String) (defaults to: :unset)
  • secret (String) (defaults to: :unset)

Returns:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/twilio-ruby/rest/ip_messaging/v2/credential.rb', line 215

def update(
    friendly_name: :unset, 
    certificate: :unset, 
    private_key: :unset, 
    sandbox: :unset, 
    api_key: :unset, 
    secret: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'Certificate' => certificate,
        'PrivateKey' => private_key,
        'Sandbox' => sandbox,
        'ApiKey' => api_key,
        'Secret' => secret,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    CredentialInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end