lib/twilio-ruby/rest/api/v2010/account/token.rb in twilio-ruby-5.77.0 vs lib/twilio-ruby/rest/api/v2010/account/token.rb in twilio-ruby-6.0.0.pre.rc.1

- old
+ new

@@ -1,161 +1,178 @@ ## -# This code was generated by -# \ / _ _ _| _ _ -# | (_)\/(_)(_|\/| |(/_ v1.0.0 -# / / +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # -# frozen_string_literal: true +# Twilio - Api +# This is the public Twilio REST API. +# +# NOTE: This class is auto generated by OpenAPI Generator. +# https://openapi-generator.tech +# Do not edit the class manually. +# + module Twilio - module REST - class Api < Domain - class V2010 < Version - class AccountContext < InstanceContext - class TokenList < ListResource - ## - # Initialize the TokenList - # @param [Version] version Version that contains the resource - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created the Token - # resource. - # @return [TokenList] TokenList - def initialize(version, account_sid: nil) - super(version) + module REST + class Api < ApiBase + class V2010 < Version + class AccountContext < InstanceContext - # Path Solution - @solution = {account_sid: account_sid} - @uri = "/Accounts/#{@solution[:account_sid]}/Tokens.json" - end + class TokenList < ListResource + ## + # Initialize the TokenList + # @param [Version] version Version that contains the resource + # @return [TokenList] TokenList + def initialize(version, account_sid: nil) + super(version) + # Path Solution + @solution = { account_sid: account_sid } + @uri = "/Accounts/#{@solution[:account_sid]}/Tokens.json" + + end + ## + # Create the TokenInstance + # @param [String] ttl The duration in seconds for which the generated credentials are valid. The default value is 86400 (24 hours). + # @return [TokenInstance] Created TokenInstance + def create( + ttl: :unset + ) - ## - # Create the TokenInstance - # @param [String] ttl The duration in seconds for which the generated credentials - # are valid. The default value is 86400 (24 hours). - # @return [TokenInstance] Created TokenInstance - def create(ttl: :unset) - data = Twilio::Values.of({'Ttl' => ttl, }) + data = Twilio::Values.of({ + 'Ttl' => ttl, + }) - payload = @version.create('POST', @uri, data: data) + payload = @version.create('POST', @uri, data: data) + TokenInstance.new( + @version, + payload, + account_sid: @solution[:account_sid], + ) + end - TokenInstance.new(@version, payload, account_sid: @solution[:account_sid], ) - end + - ## - # Provide a user friendly representation - def to_s - '#<Twilio.Api.V2010.TokenList>' - end - end - class TokenPage < Page - ## - # Initialize the TokenPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TokenPage] TokenPage - def initialize(version, response, solution) - super(version, response) + # Provide a user friendly representation + def to_s + '#<Twilio.Api.V2010.TokenList>' + end + end - # Path Solution - @solution = solution - end + class TokenPage < Page + ## + # Initialize the TokenPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [TokenPage] TokenPage + def initialize(version, response, solution) + super(version, response) - ## - # Build an instance of TokenInstance - # @param [Hash] payload Payload response from the API - # @return [TokenInstance] TokenInstance - def get_instance(payload) - TokenInstance.new(@version, payload, account_sid: @solution[:account_sid], ) - end + # Path Solution + @solution = solution + end - ## - # Provide a user friendly representation - def to_s - '<Twilio.Api.V2010.TokenPage>' - end - end + ## + # Build an instance of TokenInstance + # @param [Hash] payload Payload response from the API + # @return [TokenInstance] TokenInstance + def get_instance(payload) + TokenInstance.new(@version, payload, account_sid: @solution[:account_sid]) + end - class TokenInstance < InstanceResource - ## - # Initialize the TokenInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created the Token - # resource. - # @return [TokenInstance] TokenInstance - def initialize(version, payload, account_sid: nil) - super(version) + ## + # Provide a user friendly representation + def to_s + '<Twilio.Api.V2010.TokenPage>' + end + end + class TokenInstance < InstanceResource + ## + # Initialize the TokenInstance + # @param [Version] version Version that contains the resource + # @param [Hash] payload payload that contains response from Twilio + # @param [String] account_sid The SID of the + # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Token + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [TokenInstance] TokenInstance + def initialize(version, payload , account_sid: nil) + super(version) + + # Marshaled Properties + @properties = { + 'account_sid' => payload['account_sid'], + 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), + 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), + 'ice_servers' => payload['ice_servers'], + 'password' => payload['password'], + 'ttl' => payload['ttl'], + 'username' => payload['username'], + } + end - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), - 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), - 'ice_servers' => payload['ice_servers'], - 'password' => payload['password'], - 'ttl' => payload['ttl'], - 'username' => payload['username'], - } - end + + ## + # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. + def account_sid + @properties['account_sid'] + end + + ## + # @return [Time] The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + def date_created + @properties['date_created'] + end + + ## + # @return [Time] The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + def date_updated + @properties['date_updated'] + end + + ## + # @return [Array<ApiV2010AccountTokenIceServers>] An array representing the ephemeral credentials and the STUN and TURN server URIs. + def ice_servers + @properties['ice_servers'] + end + + ## + # @return [String] The temporary password that the username will use when authenticating with Twilio. + def password + @properties['password'] + end + + ## + # @return [String] The duration in seconds for which the username and password are valid. + def ttl + @properties['ttl'] + end + + ## + # @return [String] The temporary username that uniquely identifies a Token. + def username + @properties['username'] + end + + ## + # Provide a user friendly representation + def to_s + "<Twilio.Api.V2010.TokenInstance>" + end - ## - # @return [String] The SID of the Account that created the resource - def account_sid - @properties['account_sid'] - end + ## + # Provide a detailed, user friendly representation + def inspect + "<Twilio.Api.V2010.TokenInstance>" + end + end - ## - # @return [Time] The RFC 2822 date and time in GMT that the resource was created - def date_created - @properties['date_created'] + end end - - ## - # @return [Time] The RFC 2822 date and time in GMT that the resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [Array[String]] An array representing the ephemeral credentials - def ice_servers - @properties['ice_servers'] - end - - ## - # @return [String] The temporary password used for authenticating - def password - @properties['password'] - end - - ## - # @return [String] The duration in seconds the credentials are valid - def ttl - @properties['ttl'] - end - - ## - # @return [String] The temporary username that uniquely identifies a Token - def username - @properties['username'] - end - - ## - # Provide a user friendly representation - def to_s - "<Twilio.Api.V2010.TokenInstance>" - end - - ## - # Provide a detailed, user friendly representation - def inspect - "<Twilio.Api.V2010.TokenInstance>" - end - end end - end end - end -end \ No newline at end of file +end + +