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

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

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)


51
52
53
54
55
56
57
58
59
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 51

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)
  • start (String) (defaults to: :unset)

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/twilio-ruby/rest/preview/wireless/sim/usage.rb', line 65

def fetch(
    end_: :unset, 
    start: :unset
)

    params = Twilio::Values.of({
        'End' => end_,
        'Start' => start,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, params: params, headers: headers)
    UsageInstance.new(
        @version,
        payload,
        sim_sid: @solution[:sim_sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



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

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