class Twilio::REST::Serverless::V1::ServiceContext::AssetContext
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the AssetContext
@param [Version] version Version
that contains the resource @param [String] service_sid The SID of the Service to fetch the Asset resource
from.
@param [String] sid The SID that identifies the Asset resource to fetch. @return [AssetContext] AssetContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 172 def initialize(version, service_sid, sid) 173 super(version) 174 175 # Path Solution 176 @solution = {service_sid: service_sid, sid: sid, } 177 @uri = "/Services/#{@solution[:service_sid]}/Assets/#{@solution[:sid]}" 178 179 # Dependents 180 @asset_versions = nil 181 end
Public Instance Methods
Access the asset_versions
@return [AssetVersionList] @return [AssetVersionContext] if sid was passed.
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 216 def asset_versions(sid=:unset) 217 raise ArgumentError, 'sid cannot be nil' if sid.nil? 218 219 if sid != :unset 220 return AssetVersionContext.new(@version, @solution[:service_sid], @solution[:sid], sid, ) 221 end 222 223 unless @asset_versions 224 @asset_versions = AssetVersionList.new( 225 @version, 226 service_sid: @solution[:service_sid], 227 asset_sid: @solution[:sid], 228 ) 229 end 230 231 @asset_versions 232 end
Delete the AssetInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 195 def delete 196 @version.delete('DELETE', @uri) 197 end
Fetch the AssetInstance
@return [AssetInstance] Fetched AssetInstance
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 186 def fetch 187 payload = @version.fetch('GET', @uri) 188 189 AssetInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) 190 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 243 def inspect 244 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 245 "#<Twilio.Serverless.V1.AssetContext #{context}>" 246 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 236 def to_s 237 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 238 "#<Twilio.Serverless.V1.AssetContext #{context}>" 239 end
Update the AssetInstance
@param [String] friendly_name A descriptive string that you create to describe
the Asset resource. It can be a maximum of 255 characters.
@return [AssetInstance] Updated AssetInstance
# File lib/twilio-ruby/rest/serverless/v1/service/asset.rb 204 def update(friendly_name: nil) 205 data = Twilio::Values.of({'FriendlyName' => friendly_name, }) 206 207 payload = @version.update('POST', @uri, data: data) 208 209 AssetInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) 210 end