Class: Twilio::REST::Authy::V1::ServiceContext::EntityContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/authy/v1/service/entity.rb,
lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb,
lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.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].

Defined Under Namespace

Classes: FactorContext, FactorInstance, FactorList, FactorPage

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, identity) ⇒ EntityContext

Initialize the EntityContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The unique SID identifier of the Service.

  • identity (String)

    Customer unique identity for the Entity of the Service



176
177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/authy/v1/service/entity.rb', line 176

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
  @factors = nil
end

Instance Method Details

#deleteBoolean

Deletes the EntityInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  @version.delete('delete', @uri)
end

#factors(sid = :unset) ⇒ FactorList, FactorContext

Access the factors

Returns:

Raises:

  • (ArgumentError)


218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/authy/v1/service/entity.rb', line 218

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

#fetchEntityInstance

Fetch a EntityInstance

Returns:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/authy/v1/service/entity.rb', line 197

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  EntityInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      identity: @solution[:identity],
  )
end

#inspectObject

Provide a detailed, user friendly representation



245
246
247
248
# File 'lib/twilio-ruby/rest/authy/v1/service/entity.rb', line 245

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

#to_sObject

Provide a user friendly representation



238
239
240
241
# File 'lib/twilio-ruby/rest/authy/v1/service/entity.rb', line 238

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