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



28
29
30
31
32
33
34
35
36
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 28

def initialize(version, account_sid: nil)
    super(version)
    # Path Solution
    @solution = { account_sid:  }
    @uri = "/Accounts/#{@solution[:account_sid]}/Usage.json"
    # Components
    @records = nil
    @triggers = nil
end

Instance Method Details

#recordsRecordList, RecordContext

Access the records

Returns:



43
44
45
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 43

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

#to_sObject

Provide a user friendly representation



61
62
63
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 61

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

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

Access the triggers

Returns:

Raises:

  • (ArgumentError)


50
51
52
53
54
55
56
57
58
# File 'lib/twilio-ruby/rest/api/v2010/account/usage.rb', line 50

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