Class: Twilio::REST::IpMessaging::V1::CredentialContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::IpMessaging::V1::CredentialContext
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v1/credential.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the CredentialInstance.
-
#fetch ⇒ CredentialInstance
Fetch the CredentialInstance.
-
#initialize(version, sid) ⇒ CredentialContext
constructor
Initialize the CredentialContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance.
Constructor Details
#initialize(version, sid) ⇒ CredentialContext
Initialize the CredentialContext
179 180 181 182 183 184 185 186 187 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/credential.rb', line 179 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Credentials/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the CredentialInstance
191 192 193 194 195 196 197 198 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/credential.rb', line 191 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ CredentialInstance
Fetch the CredentialInstance
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/credential.rb', line 203 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 |
#inspect ⇒ Object
Provide a detailed, user friendly representation
270 271 272 273 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/credential.rb', line 270 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.CredentialContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
263 264 265 266 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/credential.rb', line 263 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.IpMessaging.V1.CredentialContext #{context}>" end |
#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/twilio-ruby/rest/ip_messaging/v1/credential.rb', line 228 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 |