Class: Twilio::REST::Verify::V2::ServiceContext::EntityContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Verify::V2::ServiceContext::EntityContext
- Defined in:
- lib/twilio-ruby/rest/verify/v2/service/entity.rb,
lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb,
lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb,
lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb,
lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb
Defined Under Namespace
Classes: ChallengeContext, ChallengeInstance, ChallengeList, ChallengePage, FactorContext, FactorInstance, FactorList, FactorPage, NewFactorInstance, NewFactorList, NewFactorPage
Instance Method Summary collapse
-
#challenges(sid = :unset) ⇒ ChallengeList, ChallengeContext
Access the challenges.
-
#delete ⇒ Boolean
Delete the EntityInstance.
-
#factors(sid = :unset) ⇒ FactorList, FactorContext
Access the factors.
-
#fetch ⇒ EntityInstance
Fetch the EntityInstance.
-
#initialize(version, service_sid, identity) ⇒ EntityContext
constructor
Initialize the EntityContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#new_factors ⇒ NewFactorList, NewFactorContext
Access the new_factors.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, service_sid, identity) ⇒ EntityContext
Initialize the EntityContext
165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 165 def initialize(version, service_sid, identity) super(version) # Path Solution @solution = { service_sid: service_sid, identity: identity, } @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}" # Dependents @new_factors = nil @factors = nil @challenges = nil end |
Instance Method Details
#challenges(sid = :unset) ⇒ ChallengeList, ChallengeContext
Access the challenges
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 243 def challenges(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ChallengeContext.new(@version, @solution[:service_sid], @solution[:identity],sid ) end unless @challenges @challenges = ChallengeList.new( @version, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end @challenges end |
#delete ⇒ Boolean
Delete the EntityInstance
180 181 182 183 184 185 186 187 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 180 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#factors(sid = :unset) ⇒ FactorList, FactorContext
Access the factors
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 224 def factors(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FactorContext.new(@version, @solution[:service_sid], @solution[:identity],sid ) end unless @factors @factors = FactorList.new( @version, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end @factors end |
#fetch ⇒ EntityInstance
Fetch the EntityInstance
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 192 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) EntityInstance.new( @version, payload, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
268 269 270 271 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 268 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.EntityContext #{context}>" end |
#new_factors ⇒ NewFactorList, NewFactorContext
Access the new_factors
213 214 215 216 217 218 219 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 213 def new_factors unless @new_factors @new_factors = NewFactorList.new( @version, service_sid: @solution[:service_sid], identity: @solution[:identity], ) end @new_factors end |
#to_s ⇒ Object
Provide a user friendly representation
261 262 263 264 |
# File 'lib/twilio-ruby/rest/verify/v2/service/entity.rb', line 261 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Verify.V2.EntityContext #{context}>" end |