Class: Twilio::REST::Authy::V1::FormInstance

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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

  • form_type (form.FormTypes) (defaults to: nil)

    The Type of this Form. One of ‘form-app-push`, `form-sms` or `form-totp`.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 122

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:



142
143
144
145
146
147
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 142

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

#fetchFormInstance

Fetch a FormInstance

Returns:



176
177
178
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 176

def fetch
  context.fetch
end

#form_metaHash

Returns Additional information for the available forms for this type.

Returns:

  • (Hash)

    Additional information for the available forms for this type.



163
164
165
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 163

def form_meta
  @properties['form_meta']
end

#form_typeform.FormTypes

Returns The Type of this Form.

Returns:

  • (form.FormTypes)

    The Type of this Form



151
152
153
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 151

def form_type
  @properties['form_type']
end

#formsHash

Returns Object that contains the available forms for this type.

Returns:

  • (Hash)

    Object that contains the available forms for this type.



157
158
159
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 157

def forms
  @properties['forms']
end

#inspectObject

Provide a detailed, user friendly representation



189
190
191
192
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 189

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

#to_sObject

Provide a user friendly representation



182
183
184
185
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 182

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Authy.V1.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.



169
170
171
# File 'lib/twilio-ruby/rest/authy/v1/form.rb', line 169

def url
  @properties['url']
end