Class: Twilio::REST::Verify::V2::ServiceContext::VerificationContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/verification.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, sid) ⇒ VerificationContext

Initialize the VerificationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The SID of the verification [Service](www.twilio.com/docs/verify/api/service) to update the resource from.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Verification resource to update.



129
130
131
132
133
134
135
136
137
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 129

def initialize(version, service_sid, sid)
    super(version)

    # Path Solution
    @solution = { service_sid: service_sid, sid: sid,  }
    @uri = "/Services/#{@solution[:service_sid]}/Verifications/#{@solution[:sid]}"

    
end

Instance Method Details

#fetchVerificationInstance

Fetch the VerificationInstance

Returns:



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 141

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    VerificationInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



195
196
197
198
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 195

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Verify.V2.VerificationContext #{context}>"
end

#to_sObject

Provide a user friendly representation



188
189
190
191
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 188

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Verify.V2.VerificationContext #{context}>"
end

#update(status: nil) ⇒ VerificationInstance

Update the VerificationInstance

Parameters:

  • status (Status) (defaults to: nil)

Returns:



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/twilio-ruby/rest/verify/v2/service/verification.rb', line 162

def update(
    status: nil
)

    data = Twilio::Values.of({
        'Status' => status,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    VerificationInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        sid: @solution[:sid],
    )
end