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.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 126

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

#contextFormContext

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

Returns:



146
147
148
149
150
151
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 146

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

#fetchFormInstance

Fetch the FormInstance

Returns:



180
181
182
183
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 180

def fetch

    context.fetch
end

#form_metaHash

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.



167
168
169
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 167

def form_meta
    @properties['form_meta']
end

#form_typeFormTypes

Returns:

  • (FormTypes)


155
156
157
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 155

def form_type
    @properties['form_type']
end

#formsHash

Returns Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](json-schema.org/) format.

Returns:

  • (Hash)

    Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](json-schema.org/) format



161
162
163
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 161

def forms
    @properties['forms']
end

#inspectObject

Provide a detailed, user friendly representation



194
195
196
197
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 194

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

#to_sObject

Provide a user friendly representation



187
188
189
190
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 187

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

#urlString

Returns The URL to access the forms for this type.

Returns:

  • (String)

    The URL to access the forms for this type.



173
174
175
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 173

def url
    @properties['url']
end