Class: Twilio::REST::Api::V2010::AccountContext::UsageList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/usage.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/trigger.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb,
lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb

Defined Under Namespace

Classes: RecordInstance, RecordList, RecordPage, TriggerContext, TriggerInstance, TriggerList, TriggerPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid: nil) ⇒ UsageList

Initialize the UsageList

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.


21
22
23
24
25
26
27
28
29
30
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 21

def initialize(version, account_sid: nil)
  super(version)

  # Path Solution
  @solution = {account_sid: }

  # Components
  @records = nil
  @triggers = nil
end

Instance Method Details

#recordsRecordList, RecordContext

Access the records

Returns:


36
37
38
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 36

def records
  @records ||= RecordList.new(@version, account_sid: @solution[:account_sid], )
end

#to_sObject

Provide a user friendly representation


58
59
60
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 58

def to_s
  '#<Twilio.Api.V2010.UsageList>'
end

#triggers(sid = :unset) ⇒ TriggerList, TriggerContext

Access the triggers

Parameters:

  • sid (String) (defaults to: :unset)

    The Twilio-provided string that uniquely identifies the UsageTrigger resource to fetch.

Returns:

Raises:

  • (ArgumentError)

46
47
48
49
50
51
52
53
54
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 46

def triggers(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return TriggerContext.new(@version, @solution[:account_sid], sid, )
  end

    @triggers ||= TriggerList.new(@version, account_sid: @solution[:account_sid], )
end