lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb in twilio-ruby-5.4.2 vs lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb in twilio-ruby-5.4.3
- old
+ new
@@ -19,13 +19,11 @@
# @return [TriggerList] TriggerList
def initialize(version, account_sid: nil)
super(version)
# Path Solution
- @solution = {
- account_sid: account_sid
- }
+ @solution = {account_sid: account_sid}
@uri = "/Accounts/#{@solution[:account_sid]}/Usage/Triggers.json"
end
##
# Retrieve a single page of TriggerInstance records from the API.
@@ -62,15 +60,11 @@
'POST',
@uri,
data: data
)
- TriggerInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- )
+ TriggerInstance.new(@version, payload, account_sid: @solution[:account_sid],)
end
##
# Lists TriggerInstance records from the API as a list.
# Unlike stream(), this operation is eager and will load `limit` records into
@@ -133,13 +127,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
@@ -211,15 +203,11 @@
##
# Build an instance of TriggerInstance
# @param [Hash] payload Payload response from the API
# @return [TriggerInstance] TriggerInstance
def get_instance(payload)
- TriggerInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- )
+ TriggerInstance.new(@version, payload, account_sid: @solution[:account_sid],)
end
##
# Provide a user friendly representation
def to_s
@@ -236,14 +224,11 @@
# @return [TriggerContext] TriggerContext
def initialize(version, account_sid, sid)
super(version)
# Path Solution
- @solution = {
- account_sid: account_sid,
- sid: sid,
- }
+ @solution = {account_sid: account_sid, sid: sid,}
@uri = "/Accounts/#{@solution[:account_sid]}/Usage/Triggers/#{@solution[:sid]}.json"
end
##
# Fetch a TriggerInstance
@@ -255,16 +240,11 @@
'GET',
@uri,
params,
)
- TriggerInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- sid: @solution[:sid],
- )
+ TriggerInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid],)
end
##
# Update the TriggerInstance
# @param [String] callback_method The HTTP method Twilio will use when making a
@@ -285,16 +265,11 @@
'POST',
@uri,
data: data,
)
- TriggerInstance.new(
- @version,
- payload,
- account_sid: @solution[:account_sid],
- sid: @solution[:sid],
- )
+ TriggerInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid],)
end
##
# Deletes the TriggerInstance
# @return [Boolean] true if delete succeeds, true otherwise
@@ -342,26 +317,19 @@
'usage_record_uri' => payload['usage_record_uri'],
}
# Context
@instance_context = nil
- @params = {
- 'account_sid' => account_sid,
- 'sid' => sid || @properties['sid'],
- }
+ @params = {'account_sid' => account_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 [TriggerContext] TriggerContext for this TriggerInstance
def context
unless @instance_context
- @instance_context = TriggerContext.new(
- @version,
- @params['account_sid'],
- @params['sid'],
- )
+ @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'],)
end
@instance_context
end
##
\ No newline at end of file