Class: Twilio::REST::Preview::Wireless::SimContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Wireless::SimContext
- Defined in:
- lib/twilio-ruby/rest/preview/wireless/sim.rb,
lib/twilio-ruby/rest/preview/wireless/sim/usage.rb
Defined Under Namespace
Classes: UsageContext, UsageInstance, UsageList, UsagePage
Instance Method Summary collapse
-
#fetch ⇒ SimInstance
Fetch the SimInstance.
-
#initialize(version, sid) ⇒ SimContext
constructor
Initialize the SimContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset) ⇒ SimInstance
Update the SimInstance.
-
#usage ⇒ UsageList, UsageContext
Access the usage.
Constructor Details
#initialize(version, sid) ⇒ SimContext
Initialize the SimContext
166 167 168 169 170 171 172 173 174 175 |
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 166 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Sims/#{@solution[:sid]}" # Dependents @usage = nil end |
Instance Method Details
#fetch ⇒ SimInstance
Fetch the SimInstance
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 179 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SimInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
286 287 288 289 |
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 286 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Wireless.SimContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
279 280 281 282 |
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 279 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Wireless.SimContext #{context}>" end |
#update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset) ⇒ SimInstance
Update the SimInstance
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 214 def update( unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset ) data = Twilio::Values.of({ 'UniqueName' => unique_name, 'CallbackMethod' => callback_method, 'CallbackUrl' => callback_url, 'FriendlyName' => friendly_name, 'RatePlan' => rate_plan, 'Status' => status, 'CommandsCallbackMethod' => commands_callback_method, 'CommandsCallbackUrl' => commands_callback_url, 'SmsFallbackMethod' => sms_fallback_method, 'SmsFallbackUrl' => sms_fallback_url, 'SmsMethod' => sms_method, 'SmsUrl' => sms_url, 'VoiceFallbackMethod' => voice_fallback_method, 'VoiceFallbackUrl' => voice_fallback_url, 'VoiceMethod' => voice_method, 'VoiceUrl' => voice_url, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) SimInstance.new( @version, payload, sid: @solution[:sid], ) end |
#usage ⇒ UsageList, UsageContext
Access the usage
270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/preview/wireless/sim.rb', line 270 def usage UsageContext.new( @version, @solution[:sid] ) end |