lib/twilio-ruby/rest/api/v2010/account.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/api/v2010/account.rb in twilio-ruby-5.4.3

- old
+ new

@@ -26,24 +26,19 @@ # Request is executed immediately. # @param [String] friendly_name A human readable description of the account to # create, defaults to `SubAccount Created at {YYYY-MM-DD HH:MM meridian}` # @return [AccountInstance] Newly created AccountInstance def create(friendly_name: :unset) - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - }) + data = Twilio::Values.of({'FriendlyName' => friendly_name,}) payload = @version.create( 'POST', @uri, data: data ) - AccountInstance.new( - @version, - payload, - ) + AccountInstance.new(@version, payload,) end ## # Lists AccountInstance records from the API as a list. # Unlike stream(), this operation is eager and will load `limit` records into @@ -57,16 +52,11 @@ # not set will use the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the limit with the most # efficient page size, i.e. min(limit, 1000) # @return [Array] Array of up to limit results def list(friendly_name: :unset, status: :unset, limit: nil, page_size: nil) - self.stream( - friendly_name: friendly_name, - status: status, - limit: limit, - page_size: page_size - ).entries + self.stream(friendly_name: friendly_name, status: status, limit: limit, page_size: page_size).entries end ## # Streams AccountInstance records from the API as an Enumerable. # This operation lazily loads records as efficiently as possible until the limit @@ -82,15 +72,11 @@ # efficient page size, i.e. min(limit, 1000) # @return [Enumerable] Enumerable that will yield up to limit results def stream(friendly_name: :unset, status: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) - page = self.page( - friendly_name: friendly_name, - status: status, - page_size: limits[:page_size], - ) + page = self.page(friendly_name: friendly_name, status: status, page_size: limits[:page_size],) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end ## @@ -98,13 +84,11 @@ # This operation lazily loads records as efficiently as possible until the limit # is reached. def each limits = @version.read_limits - page = self.page( - page_size: limits[:page_size], - ) + page = self.page(page_size: limits[:page_size],) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end @@ -172,14 +156,11 @@ ## # Build an instance of AccountInstance # @param [Hash] payload Payload response from the API # @return [AccountInstance] AccountInstance def get_instance(payload) - AccountInstance.new( - @version, - payload, - ) + AccountInstance.new(@version, payload,) end ## # Provide a user friendly representation def to_s @@ -196,13 +177,11 @@ # @return [AccountContext] AccountContext def initialize(version, sid) super(version) # Path Solution - @solution = { - sid: sid, - } + @solution = {sid: sid,} @uri = "/Accounts/#{@solution[:sid]}.json" # Dependents @addresses = nil @applications = nil @@ -239,63 +218,45 @@ 'GET', @uri, params, ) - AccountInstance.new( - @version, - payload, - sid: @solution[:sid], - ) + AccountInstance.new(@version, payload, sid: @solution[:sid],) end ## # Update the AccountInstance # @param [String] friendly_name Update the human-readable description of this # Account # @param [account.Status] status Alter the status of this account with a given # Status # @return [AccountInstance] Updated AccountInstance def update(friendly_name: :unset, status: :unset) - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'Status' => status, - }) + data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Status' => status,}) payload = @version.update( 'POST', @uri, data: data, ) - AccountInstance.new( - @version, - payload, - sid: @solution[:sid], - ) + AccountInstance.new(@version, payload, sid: @solution[:sid],) end ## # Access the addresses # @return [AddressList] # @return [AddressContext] if sid was passed. def addresses(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return AddressContext.new( - @version, - @solution[:sid], - sid, - ) + return AddressContext.new(@version, @solution[:sid], sid,) end unless @addresses - @addresses = AddressList.new( - @version, - account_sid: @solution[:sid], - ) + @addresses = AddressList.new(@version, account_sid: @solution[:sid],) end @addresses end @@ -305,22 +266,15 @@ # @return [ApplicationContext] if sid was passed. def applications(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return ApplicationContext.new( - @version, - @solution[:sid], - sid, - ) + return ApplicationContext.new(@version, @solution[:sid], sid,) end unless @applications - @applications = ApplicationList.new( - @version, - account_sid: @solution[:sid], - ) + @applications = ApplicationList.new(@version, account_sid: @solution[:sid],) end @applications end @@ -330,22 +284,15 @@ # @return [AuthorizedConnectAppContext] if connect_app_sid was passed. def authorized_connect_apps(connect_app_sid=:unset) raise ArgumentError, 'connect_app_sid cannot be nil' if connect_app_sid.nil? if connect_app_sid != :unset - return AuthorizedConnectAppContext.new( - @version, - @solution[:sid], - connect_app_sid, - ) + return AuthorizedConnectAppContext.new(@version, @solution[:sid], connect_app_sid,) end unless @authorized_connect_apps - @authorized_connect_apps = AuthorizedConnectAppList.new( - @version, - account_sid: @solution[:sid], - ) + @authorized_connect_apps = AuthorizedConnectAppList.new(@version, account_sid: @solution[:sid],) end @authorized_connect_apps end @@ -355,15 +302,11 @@ # @return [AvailablePhoneNumberCountryContext] if country_code was passed. def available_phone_numbers(country_code=:unset) raise ArgumentError, 'country_code cannot be nil' if country_code.nil? if country_code != :unset - return AvailablePhoneNumberCountryContext.new( - @version, - @solution[:sid], - country_code, - ) + return AvailablePhoneNumberCountryContext.new(@version, @solution[:sid], country_code,) end unless @available_phone_numbers @available_phone_numbers = AvailablePhoneNumberCountryList.new( @version, @@ -380,22 +323,15 @@ # @return [CallContext] if sid was passed. def calls(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return CallContext.new( - @version, - @solution[:sid], - sid, - ) + return CallContext.new(@version, @solution[:sid], sid,) end unless @calls - @calls = CallList.new( - @version, - account_sid: @solution[:sid], - ) + @calls = CallList.new(@version, account_sid: @solution[:sid],) end @calls end @@ -405,22 +341,15 @@ # @return [ConferenceContext] if sid was passed. def conferences(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return ConferenceContext.new( - @version, - @solution[:sid], - sid, - ) + return ConferenceContext.new(@version, @solution[:sid], sid,) end unless @conferences - @conferences = ConferenceList.new( - @version, - account_sid: @solution[:sid], - ) + @conferences = ConferenceList.new(@version, account_sid: @solution[:sid],) end @conferences end @@ -430,22 +359,15 @@ # @return [ConnectAppContext] if sid was passed. def connect_apps(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return ConnectAppContext.new( - @version, - @solution[:sid], - sid, - ) + return ConnectAppContext.new(@version, @solution[:sid], sid,) end unless @connect_apps - @connect_apps = ConnectAppList.new( - @version, - account_sid: @solution[:sid], - ) + @connect_apps = ConnectAppList.new(@version, account_sid: @solution[:sid],) end @connect_apps end @@ -455,22 +377,15 @@ # @return [IncomingPhoneNumberContext] if sid was passed. def incoming_phone_numbers(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return IncomingPhoneNumberContext.new( - @version, - @solution[:sid], - sid, - ) + return IncomingPhoneNumberContext.new(@version, @solution[:sid], sid,) end unless @incoming_phone_numbers - @incoming_phone_numbers = IncomingPhoneNumberList.new( - @version, - account_sid: @solution[:sid], - ) + @incoming_phone_numbers = IncomingPhoneNumberList.new(@version, account_sid: @solution[:sid],) end @incoming_phone_numbers end @@ -480,22 +395,15 @@ # @return [KeyContext] if sid was passed. def keys(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return KeyContext.new( - @version, - @solution[:sid], - sid, - ) + return KeyContext.new(@version, @solution[:sid], sid,) end unless @keys - @keys = KeyList.new( - @version, - account_sid: @solution[:sid], - ) + @keys = KeyList.new(@version, account_sid: @solution[:sid],) end @keys end @@ -505,22 +413,15 @@ # @return [MessageContext] if sid was passed. def messages(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return MessageContext.new( - @version, - @solution[:sid], - sid, - ) + return MessageContext.new(@version, @solution[:sid], sid,) end unless @messages - @messages = MessageList.new( - @version, - account_sid: @solution[:sid], - ) + @messages = MessageList.new(@version, account_sid: @solution[:sid],) end @messages end @@ -528,14 +429,11 @@ # Access the new_keys # @return [NewKeyList] # @return [NewKeyContext] def new_keys unless @new_keys - @new_keys = NewKeyList.new( - @version, - account_sid: @solution[:sid], - ) + @new_keys = NewKeyList.new(@version, account_sid: @solution[:sid],) end @new_keys end @@ -543,14 +441,11 @@ # Access the new_signing_keys # @return [NewSigningKeyList] # @return [NewSigningKeyContext] def new_signing_keys unless @new_signing_keys - @new_signing_keys = NewSigningKeyList.new( - @version, - account_sid: @solution[:sid], - ) + @new_signing_keys = NewSigningKeyList.new(@version, account_sid: @solution[:sid],) end @new_signing_keys end @@ -560,22 +455,15 @@ # @return [NotificationContext] if sid was passed. def notifications(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return NotificationContext.new( - @version, - @solution[:sid], - sid, - ) + return NotificationContext.new(@version, @solution[:sid], sid,) end unless @notifications - @notifications = NotificationList.new( - @version, - account_sid: @solution[:sid], - ) + @notifications = NotificationList.new(@version, account_sid: @solution[:sid],) end @notifications end @@ -585,22 +473,15 @@ # @return [OutgoingCallerIdContext] if sid was passed. def outgoing_caller_ids(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return OutgoingCallerIdContext.new( - @version, - @solution[:sid], - sid, - ) + return OutgoingCallerIdContext.new(@version, @solution[:sid], sid,) end unless @outgoing_caller_ids - @outgoing_caller_ids = OutgoingCallerIdList.new( - @version, - account_sid: @solution[:sid], - ) + @outgoing_caller_ids = OutgoingCallerIdList.new(@version, account_sid: @solution[:sid],) end @outgoing_caller_ids end @@ -610,22 +491,15 @@ # @return [QueueContext] if sid was passed. def queues(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return QueueContext.new( - @version, - @solution[:sid], - sid, - ) + return QueueContext.new(@version, @solution[:sid], sid,) end unless @queues - @queues = QueueList.new( - @version, - account_sid: @solution[:sid], - ) + @queues = QueueList.new(@version, account_sid: @solution[:sid],) end @queues end @@ -635,22 +509,15 @@ # @return [RecordingContext] if sid was passed. def recordings(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return RecordingContext.new( - @version, - @solution[:sid], - sid, - ) + return RecordingContext.new(@version, @solution[:sid], sid,) end unless @recordings - @recordings = RecordingList.new( - @version, - account_sid: @solution[:sid], - ) + @recordings = RecordingList.new(@version, account_sid: @solution[:sid],) end @recordings end @@ -660,22 +527,15 @@ # @return [SigningKeyContext] if sid was passed. def signing_keys(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return SigningKeyContext.new( - @version, - @solution[:sid], - sid, - ) + return SigningKeyContext.new(@version, @solution[:sid], sid,) end unless @signing_keys - @signing_keys = SigningKeyList.new( - @version, - account_sid: @solution[:sid], - ) + @signing_keys = SigningKeyList.new(@version, account_sid: @solution[:sid],) end @signing_keys end @@ -683,14 +543,11 @@ # Access the sip # @return [SipList] # @return [SipContext] def sip unless @sip - @sip = SipList.new( - @version, - account_sid: @solution[:sid], - ) + @sip = SipList.new(@version, account_sid: @solution[:sid],) end @sip end @@ -700,22 +557,15 @@ # @return [ShortCodeContext] if sid was passed. def short_codes(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return ShortCodeContext.new( - @version, - @solution[:sid], - sid, - ) + return ShortCodeContext.new(@version, @solution[:sid], sid,) end unless @short_codes - @short_codes = ShortCodeList.new( - @version, - account_sid: @solution[:sid], - ) + @short_codes = ShortCodeList.new(@version, account_sid: @solution[:sid],) end @short_codes end @@ -723,14 +573,11 @@ # Access the tokens # @return [TokenList] # @return [TokenContext] def tokens unless @tokens - @tokens = TokenList.new( - @version, - account_sid: @solution[:sid], - ) + @tokens = TokenList.new(@version, account_sid: @solution[:sid],) end @tokens end @@ -740,22 +587,15 @@ # @return [TranscriptionContext] if sid was passed. def transcriptions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset - return TranscriptionContext.new( - @version, - @solution[:sid], - sid, - ) + return TranscriptionContext.new(@version, @solution[:sid], sid,) end unless @transcriptions - @transcriptions = TranscriptionList.new( - @version, - account_sid: @solution[:sid], - ) + @transcriptions = TranscriptionList.new(@version, account_sid: @solution[:sid],) end @transcriptions end @@ -763,14 +603,11 @@ # Access the usage # @return [UsageList] # @return [UsageContext] def usage unless @usage - @usage = UsageList.new( - @version, - account_sid: @solution[:sid], - ) + @usage = UsageList.new(@version, account_sid: @solution[:sid],) end @usage end @@ -778,14 +615,11 @@ # Access the validation_requests # @return [ValidationRequestList] # @return [ValidationRequestContext] def validation_requests unless @validation_requests - @validation_requests = ValidationRequestList.new( - @version, - account_sid: @solution[:sid], - ) + @validation_requests = ValidationRequestList.new(@version, account_sid: @solution[:sid],) end @validation_requests end @@ -822,25 +656,20 @@ 'uri' => payload['uri'], } # Context @instance_context = nil - @params = { - 'sid' => sid || @properties['sid'], - } + @params = {'sid' => sid || @properties['sid'],} end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [AccountContext] AccountContext for this AccountInstance def context unless @instance_context - @instance_context = AccountContext.new( - @version, - @params['sid'], - ) + @instance_context = AccountContext.new(@version, @params['sid'],) end @instance_context end ## @@ -916,13 +745,10 @@ # Account # @param [account.Status] status Alter the status of this account with a given # Status # @return [AccountInstance] Updated AccountInstance def update(friendly_name: :unset, status: :unset) - context.update( - friendly_name: friendly_name, - status: status, - ) + context.update(friendly_name: friendly_name, status: status,) end ## # Access the addresses # @return [addresses] addresses \ No newline at end of file