Class: Twilio::REST::Messaging::V1::ServiceContext::ShortCodeContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service/short_code.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, sid) ⇒ ShortCodeContext

Initialize the ShortCodeContext

Parameters:



159
160
161
162
163
164
165
166
167
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 159

def initialize(version, service_sid, sid)
    super(version)

    # Path Solution
    @solution = { service_sid: service_sid, sid: sid,  }
    @uri = "/Services/#{@solution[:service_sid]}/ShortCodes/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the ShortCodeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



171
172
173
174
175
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 171

def delete

    
    @version.delete('DELETE', @uri)
end

#fetchShortCodeInstance

Fetch the ShortCodeInstance

Returns:



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 180

def fetch

    
    payload = @version.fetch('GET', @uri)
    ShortCodeInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



202
203
204
205
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 202

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

#to_sObject

Provide a user friendly representation



195
196
197
198
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 195

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