Class: Twilio::REST::Numbers::V1::BulkEligibilityInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, request_id: nil) ⇒ BulkEligibilityInstance

Initialize the BulkEligibilityInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this BulkEligibility resource.

  • sid (String) —

    The SID of the Call resource to fetch.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 253

def initialize(version, payload , request_id: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'request_id' => payload['request_id'],
        'url' => payload['url'],
        'results' => payload['results'],
        'friendly_name' => payload['friendly_name'],
        'status' => payload['status'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_completed' => Twilio.deserialize_iso8601_datetime(payload['date_completed']),
    }

    # Context
    @instance_context = nil
    @params = { 'request_id' => request_id  || @properties['request_id']  , }
end

Instance Method Details

#context ⇒ BulkEligibilityContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 277

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

#date_completed ⇒ Time

Returns:

  • (Time)


322
323
324
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 322

def date_completed
    @properties['date_completed']
end

#date_created ⇒ Time

Returns:

  • (Time)


316
317
318
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 316

def date_created
    @properties['date_created']
end

#fetch ⇒ BulkEligibilityInstance

Fetch the BulkEligibilityInstance

Returns:



329
330
331
332
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 329

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns This is the string that you assigned as a friendly name for describing the eligibility check request.

Returns:

  • (String) —

    This is the string that you assigned as a friendly name for describing the eligibility check request.



304
305
306
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 304

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



343
344
345
346
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 343

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

#request_id ⇒ String

Returns The SID of the bulk eligibility check that you want to know about.

Returns:

  • (String) —

    The SID of the bulk eligibility check that you want to know about.



286
287
288
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 286

def request_id
    @properties['request_id']
end

#results ⇒ Array<Hash>

Returns The result set that contains the eligibility check response for each requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status.

Returns:

  • (Array<Hash>) —

    The result set that contains the eligibility check response for each requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status.



298
299
300
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 298

def results
    @properties['results']
end

#status ⇒ String

Returns This is the status of the bulk eligibility check request. (Example: COMPLETE, IN_PROGRESS).

Returns:

  • (String) —

    This is the status of the bulk eligibility check request. (Example: COMPLETE, IN_PROGRESS)



310
311
312
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 310

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



336
337
338
339
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 336

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Numbers.V1.BulkEligibilityInstance #{values}>"
end

#url ⇒ String

Returns This is the url of the request that you're trying to reach out to locate the resource.

Returns:

  • (String) —

    This is the url of the request that you're trying to reach out to locate the resource.



292
293
294
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 292

def url
    @properties['url']
end