Class: Twilio::REST::Serverless::V1::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Serverless::V1::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/serverless/v1/service.rb,
lib/twilio-ruby/rest/serverless/v1/service/asset.rb,
lib/twilio-ruby/rest/serverless/v1/service/build.rb,
lib/twilio-ruby/rest/serverless/v1/service/function.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb,
lib/twilio-ruby/rest/serverless/v1/service/build/build_status.rb,
lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb,
lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb,
lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb
Defined Under Namespace
Classes: AssetContext, AssetInstance, AssetList, AssetPage, BuildContext, BuildInstance, BuildList, BuildPage, EnvironmentContext, EnvironmentInstance, EnvironmentList, EnvironmentPage, FunctionContext, FunctionInstance, FunctionList, FunctionPage
Instance Method Summary collapse
-
#assets(sid = :unset) ⇒ AssetList, AssetContext
Access the assets.
-
#builds(sid = :unset) ⇒ BuildList, BuildContext
Access the builds.
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#environments(sid = :unset) ⇒ EnvironmentList, EnvironmentContext
Access the environments.
-
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance.
-
#functions(sid = :unset) ⇒ FunctionList, FunctionContext
Access the functions.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 170 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @environments = nil @functions = nil @builds = nil @assets = nil end |
Instance Method Details
#assets(sid = :unset) ⇒ AssetList, AssetContext
Access the assets
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 307 def assets(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return AssetContext.new(@version, @solution[:sid],sid ) end unless @assets @assets = AssetList.new( @version, service_sid: @solution[:sid], ) end @assets end |
#builds(sid = :unset) ⇒ BuildList, BuildContext
Access the builds
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 288 def builds(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return BuildContext.new(@version, @solution[:sid],sid ) end unless @builds @builds = BuildList.new( @version, service_sid: @solution[:sid], ) end @builds end |
#delete ⇒ Boolean
Delete the ServiceInstance
186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 186 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#environments(sid = :unset) ⇒ EnvironmentList, EnvironmentContext
Access the environments
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 250 def environments(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return EnvironmentContext.new(@version, @solution[:sid],sid ) end unless @environments @environments = EnvironmentList.new( @version, service_sid: @solution[:sid], ) end @environments end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 198 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#functions(sid = :unset) ⇒ FunctionList, FunctionContext
Access the functions
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 269 def functions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FunctionContext.new(@version, @solution[:sid],sid ) end unless @functions @functions = FunctionList.new( @version, service_sid: @solution[:sid], ) end @functions end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
332 333 334 335 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 332 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.ServiceContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
325 326 327 328 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 325 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.ServiceContext #{context}>" end |
#update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset) ⇒ ServiceInstance
Update the ServiceInstance
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/twilio-ruby/rest/serverless/v1/service.rb', line 220 def update( include_credentials: :unset, friendly_name: :unset, ui_editable: :unset ) data = Twilio::Values.of({ 'IncludeCredentials' => include_credentials, 'FriendlyName' => friendly_name, 'UiEditable' => ui_editable, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |