class Bandwidth::Result

Result Model.

Attributes

country[RW]

The country of the telephone number. @return [String]

e_164_format[RW]

The telephone number in E.164 format. @return [String]

formatted[RW]

The formatted version of the telephone number. @return [String]

line_provider[RW]

The service provider of the telephone number. @return [String]

line_type[RW]

The line type of the telephone number. @return [String]

message[RW]

Message associated with the response code. @return [String]

mobile_country_code[RW]

The first half of the Home Network Identity (HNI). @return [String]

mobile_network_code[RW]

The second half of the HNI. @return [String]

response_code[RW]

Our vendor's response code. @return [Integer]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb, line 81
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  response_code = hash['Response Code']
  message = hash['Message']
  e_164_format = hash['E.164 Format']
  formatted = hash['Formatted']
  country = hash['Country']
  line_type = hash['Line Type']
  line_provider = hash['Line Provider']
  mobile_country_code = hash['Mobile Country Code']
  mobile_network_code = hash['Mobile Network Code']

  # Create object from extracted values.
  Result.new(response_code,
             message,
             e_164_format,
             formatted,
             country,
             line_type,
             line_provider,
             mobile_country_code,
             mobile_network_code)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb, line 46
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['response_code'] = 'Response Code'
  @_hash['message'] = 'Message'
  @_hash['e_164_format'] = 'E.164 Format'
  @_hash['formatted'] = 'Formatted'
  @_hash['country'] = 'Country'
  @_hash['line_type'] = 'Line Type'
  @_hash['line_provider'] = 'Line Provider'
  @_hash['mobile_country_code'] = 'Mobile Country Code'
  @_hash['mobile_network_code'] = 'Mobile Network Code'
  @_hash
end
new(response_code = nil, message = nil, e_164_format = nil, formatted = nil, country = nil, line_type = nil, line_provider = nil, mobile_country_code = nil, mobile_network_code = nil) click to toggle source
# File lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb, line 60
def initialize(response_code = nil,
               message = nil,
               e_164_format = nil,
               formatted = nil,
               country = nil,
               line_type = nil,
               line_provider = nil,
               mobile_country_code = nil,
               mobile_network_code = nil)
  @response_code = response_code
  @message = message
  @e_164_format = e_164_format
  @formatted = formatted
  @country = country
  @line_type = line_type
  @line_provider = line_provider
  @mobile_country_code = mobile_country_code
  @mobile_network_code = mobile_network_code
end