Class: Twilio::REST::Serverless::V1::ServiceContext::AssetContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Serverless::V1::ServiceContext::AssetContext
- Defined in:
- lib/twilio-ruby/rest/serverless/v1/service/asset.rb,
lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb
Defined Under Namespace
Classes: AssetVersionContext, AssetVersionInstance, AssetVersionList, AssetVersionPage
Instance Method Summary collapse
-
#asset_versions(sid = :unset) ⇒ AssetVersionList, AssetVersionContext
Access the asset_versions.
-
#delete ⇒ Boolean
Delete the AssetInstance.
-
#fetch ⇒ AssetInstance
Fetch the AssetInstance.
-
#initialize(version, service_sid, sid) ⇒ AssetContext
constructor
Initialize the AssetContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: nil) ⇒ AssetInstance
Update the AssetInstance.
Constructor Details
#initialize(version, service_sid, sid) ⇒ AssetContext
Initialize the AssetContext
165 166 167 168 169 170 171 172 173 174 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 165 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Assets/#{@solution[:sid]}" # Dependents @asset_versions = nil end |
Instance Method Details
#asset_versions(sid = :unset) ⇒ AssetVersionList, AssetVersionContext
Access the asset_versions
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 238 def asset_versions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return AssetVersionContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @asset_versions @asset_versions = AssetVersionList.new( @version, service_sid: @solution[:service_sid], asset_sid: @solution[:sid], ) end @asset_versions end |
#delete ⇒ Boolean
Delete the AssetInstance
178 179 180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 178 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ AssetInstance
Fetch the AssetInstance
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 190 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) AssetInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
263 264 265 266 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 263 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.AssetContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
256 257 258 259 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 256 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.AssetContext #{context}>" end |
#update(friendly_name: nil) ⇒ AssetInstance
Update the AssetInstance
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset.rb', line 211 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) AssetInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |