Class: Twilio::REST::Verify::V2::FormContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Verify::V2::FormContext
- Defined in:
- lib/twilio-ruby/rest/verify/v2/form.rb
Instance Method Summary collapse
-
#fetch ⇒ FormInstance
Fetch the FormInstance.
-
#fetch_with_metadata ⇒ FormInstance
Fetch the FormInstanceMetadata.
-
#initialize(version, form_type) ⇒ FormContext
constructor
Initialize the FormContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, form_type) ⇒ FormContext
Initialize the FormContext
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 50 def initialize(version, form_type) super(version) # Path Solution @solution = { form_type: form_type, } @uri = "/Forms/#{@solution[:form_type]}" end |
Instance Method Details
#fetch ⇒ FormInstance
Fetch the FormInstance
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 63 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) FormInstance.new( @version, payload, form_type: @solution[:form_type], ) end |
#fetch_with_metadata ⇒ FormInstance
Fetch the FormInstanceMetadata
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 82 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) form_instance = FormInstance.new( @version, response.body, form_type: @solution[:form_type], ) FormInstanceMetadata.new( @version, form_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
114 115 116 117 |
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 114 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.FormContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
107 108 109 110 |
# File 'lib/twilio-ruby/rest/verify/v2/form.rb', line 107 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.FormContext #{context}>" end |