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.



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 143

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

#contextBulkEligibilityContext

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

Returns:



166
167
168
169
170
171
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 166

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

#date_completedTime

Returns:

  • (Time)


211
212
213
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 211

def date_completed
    @properties['date_completed']
end

#date_createdTime

Returns:

  • (Time)


205
206
207
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 205

def date_created
    @properties['date_created']
end

#fetchBulkEligibilityInstance

Fetch the BulkEligibilityInstance

Returns:



218
219
220
221
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 218

def fetch

    context.fetch
end

#friendly_nameString

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.



193
194
195
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 193

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



232
233
234
235
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 232

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

#request_idString

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.



175
176
177
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 175

def request_id
    @properties['request_id']
end

#resultsArray<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.



187
188
189
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 187

def results
    @properties['results']
end

#statusString

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)



199
200
201
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 199

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



225
226
227
228
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 225

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

#urlString

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.



181
182
183
# File 'lib/twilio-ruby/rest/numbers/v1/bulk_eligibility.rb', line 181

def url
    @properties['url']
end