Class: Twilio::REST::Verify::V2::FormInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/verify/v2/form.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, form_type: nil) ⇒ FormInstance

Initialize the FormInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this Form resource.

  • sid (String) —

    The SID of the Call resource to fetch.



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 207

def initialize(version, payload , form_type: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'form_type' => payload['form_type'],
        'forms' => payload['forms'],
        'form_meta' => payload['form_meta'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'form_type' => form_type  || @properties['form_type']  , }
end

Instance Method Details

#context ⇒ FormContext

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

Returns:



228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 228

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

#fetch ⇒ FormInstance

Fetch the FormInstance

Returns:



262
263
264
265
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 262

def fetch

    context.fetch
end

#form_meta ⇒ Hash

Returns Additional information for the available forms for this type. E.g. The separator string used for binding in a Factor push.

Returns:

  • (Hash) —

    Additional information for the available forms for this type. E.g. The separator string used for binding in a Factor push.



249
250
251
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 249

def form_meta
    @properties['form_meta']
end

#form_type ⇒ FormTypes

Returns:

  • (FormTypes)


237
238
239
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 237

def form_type
    @properties['form_type']
end

#forms ⇒ Hash

Returns Object that contains the available forms for this type. This available forms are given in the standard JSON Schema format.

Returns:

  • (Hash) —

    Object that contains the available forms for this type. This available forms are given in the standard JSON Schema format



243
244
245
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 243

def forms
    @properties['forms']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



276
277
278
279
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 276

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

#to_s ⇒ Object

Provide a user friendly representation



269
270
271
272
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 269

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

#url ⇒ String

Returns The URL to access the forms for this type.

Returns:

  • (String) —

    The URL to access the forms for this type.



255
256
257
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 255

def url
    @properties['url']
end