Class: Bandwidth::OrderStatus

Inherits:
BaseModel show all
Defined in:
lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb

Overview

If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(request_id = nil, status = nil, failed_telephone_numbers = nil, result = nil) ⇒ OrderStatus

Returns a new instance of OrderStatus.



40
41
42
43
44
45
46
47
48
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 40

def initialize(request_id = nil,
               status = nil,
               failed_telephone_numbers = nil,
               result = nil)
  @request_id = request_id
  @status = status
  @failed_telephone_numbers = failed_telephone_numbers
  @result = result
end

Instance Attribute Details

#failed_telephone_numbersList of String

The telephone numbers whose lookup failed

Returns:

  • (List of String)


24
25
26
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 24

def failed_telephone_numbers
  @failed_telephone_numbers
end

#request_idString

The requestId.

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 15

def request_id
  @request_id
end

#resultList of Result

The carrier information results for the specified telephone number.

Returns:



28
29
30
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 28

def result
  @result
end

#statusString

The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or FAILED).

Returns:

  • (String)


20
21
22
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 20

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 51

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash['requestId']
  status = hash['status']
  failed_telephone_numbers = hash['failedTelephoneNumbers']
  # Parameter is an array, so we need to iterate through it
  result = nil
  unless hash['result'].nil?
    result = []
    hash['result'].each do |structure|
      result << (Result.from_hash(structure) if structure)
    end
  end

  # Create object from extracted values.
  OrderStatus.new(request_id,
                  status,
                  failed_telephone_numbers,
                  result)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'requestId'
  @_hash['status'] = 'status'
  @_hash['failed_telephone_numbers'] = 'failedTelephoneNumbers'
  @_hash['result'] = 'result'
  @_hash
end