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



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 131

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



151
152
153
154
155
156
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 151

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

#fetchFormInstance

Fetch the FormInstance



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

def fetch

    context.fetch
end

#form_metaHash



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

def form_meta
    @properties['form_meta']
end

#form_typeFormTypes



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

def form_type
    @properties['form_type']
end

#formsHash



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

def forms
    @properties['forms']
end

#inspectObject

Provide a detailed, user friendly representation



199
200
201
202
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 199

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

#to_sObject

Provide a user friendly representation



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

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

#urlString



178
179
180
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 178

def url
    @properties['url']
end