lib/twilio-ruby/rest/trunking/v1/trunk.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/trunking/v1/trunk.rb in twilio-ruby-5.4.3
- old
+ new
@@ -45,14 +45,11 @@
'POST',
@uri,
data: data
)
- TrunkInstance.new(
- @version,
- payload,
- )
+ TrunkInstance.new(@version, payload,)
end
##
# Lists TrunkInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
@@ -63,14 +60,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(limit: nil, page_size: nil)
- self.stream(
- limit: limit,
- page_size: page_size
- ).entries
+ self.stream(limit: limit, page_size: page_size).entries
end
##
# Streams TrunkInstance records from the API as an Enumerable.
# This operation lazily loads records as efficiently as possible until the limit
@@ -83,13 +77,11 @@
# efficient page size, i.e. min(limit, 1000)
# @return [Enumerable] Enumerable that will yield up to limit results
def stream(limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
- 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])
end
##
@@ -97,13 +89,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
@@ -166,14 +156,11 @@
##
# Build an instance of TrunkInstance
# @param [Hash] payload Payload response from the API
# @return [TrunkInstance] TrunkInstance
def get_instance(payload)
- TrunkInstance.new(
- @version,
- payload,
- )
+ TrunkInstance.new(@version, payload,)
end
##
# Provide a user friendly representation
def to_s
@@ -189,13 +176,11 @@
# @return [TrunkContext] TrunkContext
def initialize(version, sid)
super(version)
# Path Solution
- @solution = {
- sid: sid,
- }
+ @solution = {sid: sid,}
@uri = "/Trunks/#{@solution[:sid]}"
# Dependents
@origination_urls = nil
@credentials_lists = nil
@@ -213,15 +198,11 @@
'GET',
@uri,
params,
)
- TrunkInstance.new(
- @version,
- payload,
- sid: @solution[:sid],
- )
+ TrunkInstance.new(@version, payload, sid: @solution[:sid],)
end
##
# Deletes the TrunkInstance
# @return [Boolean] true if delete succeeds, true otherwise
@@ -252,37 +233,26 @@
'POST',
@uri,
data: data,
)
- TrunkInstance.new(
- @version,
- payload,
- sid: @solution[:sid],
- )
+ TrunkInstance.new(@version, payload, sid: @solution[:sid],)
end
##
# Access the origination_urls
# @return [OriginationUrlList]
# @return [OriginationUrlContext] if sid was passed.
def origination_urls(sid=:unset)
raise ArgumentError, 'sid cannot be nil' if sid.nil?
if sid != :unset
- return OriginationUrlContext.new(
- @version,
- @solution[:sid],
- sid,
- )
+ return OriginationUrlContext.new(@version, @solution[:sid], sid,)
end
unless @origination_urls
- @origination_urls = OriginationUrlList.new(
- @version,
- trunk_sid: @solution[:sid],
- )
+ @origination_urls = OriginationUrlList.new(@version, trunk_sid: @solution[:sid],)
end
@origination_urls
end
@@ -292,22 +262,15 @@
# @return [CredentialListContext] if sid was passed.
def credentials_lists(sid=:unset)
raise ArgumentError, 'sid cannot be nil' if sid.nil?
if sid != :unset
- return CredentialListContext.new(
- @version,
- @solution[:sid],
- sid,
- )
+ return CredentialListContext.new(@version, @solution[:sid], sid,)
end
unless @credentials_lists
- @credentials_lists = CredentialListList.new(
- @version,
- trunk_sid: @solution[:sid],
- )
+ @credentials_lists = CredentialListList.new(@version, trunk_sid: @solution[:sid],)
end
@credentials_lists
end
@@ -317,22 +280,15 @@
# @return [IpAccessControlListContext] if sid was passed.
def ip_access_control_lists(sid=:unset)
raise ArgumentError, 'sid cannot be nil' if sid.nil?
if sid != :unset
- return IpAccessControlListContext.new(
- @version,
- @solution[:sid],
- sid,
- )
+ return IpAccessControlListContext.new(@version, @solution[:sid], sid,)
end
unless @ip_access_control_lists
- @ip_access_control_lists = IpAccessControlListList.new(
- @version,
- trunk_sid: @solution[:sid],
- )
+ @ip_access_control_lists = IpAccessControlListList.new(@version, trunk_sid: @solution[:sid],)
end
@ip_access_control_lists
end
@@ -342,22 +298,15 @@
# @return [PhoneNumberContext] if sid was passed.
def phone_numbers(sid=:unset)
raise ArgumentError, 'sid cannot be nil' if sid.nil?
if sid != :unset
- return PhoneNumberContext.new(
- @version,
- @solution[:sid],
- sid,
- )
+ return PhoneNumberContext.new(@version, @solution[:sid], sid,)
end
unless @phone_numbers
- @phone_numbers = PhoneNumberList.new(
- @version,
- trunk_sid: @solution[:sid],
- )
+ @phone_numbers = PhoneNumberList.new(@version, trunk_sid: @solution[:sid],)
end
@phone_numbers
end
@@ -397,24 +346,19 @@
'links' => payload['links'],
}
# 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 [TrunkContext] TrunkContext for this TrunkInstance
def context
unless @instance_context
- @instance_context = TrunkContext.new(
- @version,
- @params['sid'],
- )
+ @instance_context = TrunkContext.new(@version, @params['sid'],)
end
@instance_context
end
##
\ No newline at end of file