Class: Twilio::REST::Preview::Wireless::SimContext::UsageContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/wireless/sim/usage.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected]

Instance Method Summary collapse

Constructor Details

#initialize(version, sim_sid) ⇒ UsageContext

Initialize the UsageContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sim_sid (String)

    The sim_sid


75
76
77
78
79
80
81
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 75

def initialize(version, sim_sid)
  super(version)

  # Path Solution
  @solution = {sim_sid: sim_sid, }
  @uri = "/Sims/#{@solution[:sim_sid]}/Usage"
end

Instance Method Details

#fetch(end_: :unset, start: :unset) ⇒ UsageInstance

Fetch the UsageInstance

Parameters:

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

    The end

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

    The start

Returns:


88
89
90
91
92
93
94
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 88

def fetch(end_: :unset, start: :unset)
  params = Twilio::Values.of({'End' => end_, 'Start' => start, })

  payload = @version.fetch('GET', @uri, params: params)

  UsageInstance.new(@version, payload, sim_sid: @solution[:sim_sid], )
end

#inspectObject

Provide a detailed, user friendly representation


105
106
107
108
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 105

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.Wireless.UsageContext #{context}>"
end

#to_sObject

Provide a user friendly representation


98
99
100
101
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 98

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.Wireless.UsageContext #{context}>"
end