Class: Twilio::REST::Preview::Wireless::SimContext::UsageInstance

Inherits:
InstanceResource
  • 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, payload, sim_sid: nil) ⇒ UsageInstance

Initialize the UsageInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sim_sid (String) (defaults to: nil)

    The sim_sid


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 120

def initialize(version, payload, sim_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sim_sid' => payload['sim_sid'],
      'sim_unique_name' => payload['sim_unique_name'],
      'account_sid' => payload['account_sid'],
      'period' => payload['period'],
      'commands_usage' => payload['commands_usage'],
      'commands_costs' => payload['commands_costs'],
      'data_usage' => payload['data_usage'],
      'data_costs' => payload['data_costs'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'sim_sid' => sim_sid, }
end

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid


166
167
168
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 166

def 
  @properties['account_sid']
end

#commands_costsHash

Returns The commands_costs.

Returns:

  • (Hash)

    The commands_costs


184
185
186
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 184

def commands_costs
  @properties['commands_costs']
end

#commands_usageHash

Returns The commands_usage.

Returns:

  • (Hash)

    The commands_usage


178
179
180
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 178

def commands_usage
  @properties['commands_usage']
end

#contextUsageContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


145
146
147
148
149
150
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 145

def context
  unless @instance_context
    @instance_context = UsageContext.new(@version, @params['sim_sid'], )
  end
  @instance_context
end

#data_costsHash

Returns The data_costs.

Returns:

  • (Hash)

    The data_costs


196
197
198
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 196

def data_costs
  @properties['data_costs']
end

#data_usageHash

Returns The data_usage.

Returns:

  • (Hash)

    The data_usage


190
191
192
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 190

def data_usage
  @properties['data_usage']
end

#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:


211
212
213
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 211

def fetch(end_: :unset, start: :unset)
  context.fetch(end_: end_, start: start, )
end

#inspectObject

Provide a detailed, user friendly representation


224
225
226
227
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 224

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Preview.Wireless.UsageInstance #{values}>"
end

#periodHash

Returns The period.

Returns:

  • (Hash)

    The period


172
173
174
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 172

def period
  @properties['period']
end

#sim_sidString

Returns The sim_sid.

Returns:

  • (String)

    The sim_sid


154
155
156
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 154

def sim_sid
  @properties['sim_sid']
end

#sim_unique_nameString

Returns The sim_unique_name.

Returns:

  • (String)

    The sim_unique_name


160
161
162
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 160

def sim_unique_name
  @properties['sim_unique_name']
end

#to_sObject

Provide a user friendly representation


217
218
219
220
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 217

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Preview.Wireless.UsageInstance #{values}>"
end

#urlString

Returns The url.

Returns:

  • (String)

    The url


202
203
204
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 202

def url
  @properties['url']
end