lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb in twilio-ruby-5.4.3
- old
+ new
@@ -20,13 +20,11 @@
# @return [CertificateList] CertificateList
def initialize(version, fleet_sid: nil)
super(version)
# Path Solution
- @solution = {
- fleet_sid: fleet_sid
- }
+ @solution = {fleet_sid: fleet_sid}
@uri = "/Fleets/#{@solution[:fleet_sid]}/Certificates"
end
##
# Retrieve a single page of CertificateInstance records from the API.
@@ -49,15 +47,11 @@
'POST',
@uri,
data: data
)
- CertificateInstance.new(
- @version,
- payload,
- fleet_sid: @solution[:fleet_sid],
- )
+ CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid],)
end
##
# Lists CertificateInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
@@ -70,15 +64,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(device_sid: :unset, limit: nil, page_size: nil)
- self.stream(
- device_sid: device_sid,
- limit: limit,
- page_size: page_size
- ).entries
+ self.stream(device_sid: device_sid, limit: limit, page_size: page_size).entries
end
##
# Streams CertificateInstance records from the API as an Enumerable.
# This operation lazily loads records as efficiently as possible until the limit
@@ -93,14 +83,11 @@
# efficient page size, i.e. min(limit, 1000)
# @return [Enumerable] Enumerable that will yield up to limit results
def stream(device_sid: :unset, limit: nil, page_size: nil)
limits = @version.read_limits(limit, page_size)
- page = self.page(
- device_sid: device_sid,
- page_size: limits[:page_size],
- )
+ page = self.page(device_sid: device_sid, page_size: limits[:page_size],)
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
end
##
@@ -108,13 +95,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
@@ -182,15 +167,11 @@
##
# Build an instance of CertificateInstance
# @param [Hash] payload Payload response from the API
# @return [CertificateInstance] CertificateInstance
def get_instance(payload)
- CertificateInstance.new(
- @version,
- payload,
- fleet_sid: @solution[:fleet_sid],
- )
+ CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -210,14 +191,11 @@
# @return [CertificateContext] CertificateContext
def initialize(version, fleet_sid, sid)
super(version)
# Path Solution
- @solution = {
- fleet_sid: fleet_sid,
- sid: sid,
- }
+ @solution = {fleet_sid: fleet_sid, sid: sid,}
@uri = "/Fleets/#{@solution[:fleet_sid]}/Certificates/#{@solution[:sid]}"
end
##
# Fetch a CertificateInstance
@@ -229,16 +207,11 @@
'GET',
@uri,
params,
)
- CertificateInstance.new(
- @version,
- payload,
- fleet_sid: @solution[:fleet_sid],
- sid: @solution[:sid],
- )
+ CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid],)
end
##
# Deletes the CertificateInstance
# @return [Boolean] true if delete succeeds, true otherwise
@@ -252,27 +225,19 @@
# this Certificate credential, up to 256 characters long.
# @param [String] device_sid Provides the unique string identifier of an existing
# Device to become authenticated with this Certificate credential.
# @return [CertificateInstance] Updated CertificateInstance
def update(friendly_name: :unset, device_sid: :unset)
- data = Twilio::Values.of({
- 'FriendlyName' => friendly_name,
- 'DeviceSid' => device_sid,
- })
+ data = Twilio::Values.of({'FriendlyName' => friendly_name, 'DeviceSid' => device_sid,})
payload = @version.update(
'POST',
@uri,
data: data,
)
- CertificateInstance.new(
- @version,
- payload,
- fleet_sid: @solution[:fleet_sid],
- sid: @solution[:sid],
- )
+ CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -309,27 +274,20 @@
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
}
# Context
@instance_context = nil
- @params = {
- 'fleet_sid' => fleet_sid,
- 'sid' => sid || @properties['sid'],
- }
+ @params = {'fleet_sid' => fleet_sid, '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 [CertificateContext] CertificateContext for this CertificateInstance
def context
unless @instance_context
- @instance_context = CertificateContext.new(
- @version,
- @params['fleet_sid'],
- @params['sid'],
- )
+ @instance_context = CertificateContext.new(@version, @params['fleet_sid'], @params['sid'],)
end
@instance_context
end
##
@@ -406,13 +364,10 @@
# this Certificate credential, up to 256 characters long.
# @param [String] device_sid Provides the unique string identifier of an existing
# Device to become authenticated with this Certificate credential.
# @return [CertificateInstance] Updated CertificateInstance
def update(friendly_name: :unset, device_sid: :unset)
- context.update(
- friendly_name: friendly_name,
- device_sid: device_sid,
- )
+ context.update(friendly_name: friendly_name, device_sid: device_sid,)
end
##
# Provide a user friendly representation
def to_s
\ No newline at end of file