Class: Twilio::REST::Api::V2010::AccountContext::ShortCodeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::ShortCodeContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/short_code.rb
Instance Method Summary collapse
-
#fetch ⇒ ShortCodeInstance
Fetch the ShortCodeInstance.
-
#initialize(version, account_sid, sid) ⇒ ShortCodeContext
constructor
Initialize the ShortCodeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) ⇒ ShortCodeInstance
Update the ShortCodeInstance.
Constructor Details
#initialize(version, account_sid, sid) ⇒ ShortCodeContext
Initialize the ShortCodeContext
151 152 153 154 155 156 157 158 159 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 151 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/SMS/ShortCodes/#{@solution[:sid]}.json" end |
Instance Method Details
#fetch ⇒ ShortCodeInstance
Fetch the ShortCodeInstance
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 163 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ShortCodeInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
232 233 234 235 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 232 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.ShortCodeContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
225 226 227 228 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 225 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.ShortCodeContext #{context}>" end |
#update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) ⇒ ShortCodeInstance
Update the ShortCodeInstance
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 189 def update( friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ApiVersion' => api_version, 'SmsUrl' => sms_url, 'SmsMethod' => sms_method, 'SmsFallbackUrl' => sms_fallback_url, 'SmsFallbackMethod' => sms_fallback_method, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ShortCodeInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |