Class: Bandwidth::Result
- Defined in:
- lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb
Overview
Result Model.
Instance Attribute Summary collapse
-
#country ⇒ String
The country of the telephone number.
-
#e_164_format ⇒ String
The telephone number in E.164 format.
-
#formatted ⇒ String
The formatted version of the telephone number.
-
#line_provider ⇒ String
The service provider of the telephone number.
-
#line_type ⇒ String
The line type of the telephone number.
-
#message ⇒ String
Message associated with the response code.
-
#mobile_country_code ⇒ String
The first half of the Home Network Identity (HNI).
-
#mobile_network_code ⇒ String
The second half of the HNI.
-
#response_code ⇒ Integer
Our vendor’s response code.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#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) ⇒ Result
constructor
A new instance of Result.
-
#nullables ⇒ Object
An array for nullable fields.
-
#optionals ⇒ Object
An array for optional fields.
Methods inherited from BaseModel
Constructor Details
#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) ⇒ Result
Returns a new instance of Result.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 83 def initialize(response_code = nil, = 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 unless response_code == SKIP @message = unless == SKIP @e_164_format = e_164_format unless e_164_format == SKIP @formatted = formatted unless formatted == SKIP @country = country unless country == SKIP @line_type = line_type unless line_type == SKIP @line_provider = line_provider unless line_provider == SKIP @mobile_country_code = mobile_country_code unless mobile_country_code == SKIP @mobile_network_code = mobile_network_code unless mobile_network_code == SKIP end |
Instance Attribute Details
#country ⇒ String
The country of the telephone number.
30 31 32 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 30 def country @country end |
#e_164_format ⇒ String
The telephone number in E.164 format.
22 23 24 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 22 def e_164_format @e_164_format end |
#formatted ⇒ String
The formatted version of the telephone number.
26 27 28 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 26 def formatted @formatted end |
#line_provider ⇒ String
The service provider of the telephone number.
38 39 40 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 38 def line_provider @line_provider end |
#line_type ⇒ String
The line type of the telephone number.
34 35 36 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 34 def line_type @line_type end |
#message ⇒ String
Message associated with the response code.
18 19 20 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 18 def @message end |
#mobile_country_code ⇒ String
The first half of the Home Network Identity (HNI).
42 43 44 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 42 def mobile_country_code @mobile_country_code end |
#mobile_network_code ⇒ String
The second half of the HNI.
46 47 48 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 46 def mobile_network_code @mobile_network_code end |
#response_code ⇒ Integer
Our vendor’s response code.
14 15 16 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 14 def response_code @response_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 104 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. response_code = hash.key?('Response Code') ? hash['Response Code'] : SKIP = hash.key?('Message') ? hash['Message'] : SKIP e_164_format = hash.key?('E.164 Format') ? hash['E.164 Format'] : SKIP formatted = hash.key?('Formatted') ? hash['Formatted'] : SKIP country = hash.key?('Country') ? hash['Country'] : SKIP line_type = hash.key?('Line Type') ? hash['Line Type'] : SKIP line_provider = hash.key?('Line Provider') ? hash['Line Provider'] : SKIP mobile_country_code = hash.key?('Mobile Country Code') ? hash['Mobile Country Code'] : SKIP mobile_network_code = hash.key?('Mobile Network Code') ? hash['Mobile Network Code'] : SKIP # Create object from extracted values. Result.new(response_code, , e_164_format, formatted, country, line_type, line_provider, mobile_country_code, mobile_network_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 49 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 |
Instance Method Details
#nullables ⇒ Object
An array for nullable fields
79 80 81 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 79 def nullables [] end |
#optionals ⇒ Object
An array for optional fields
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 64 def optionals %w[ response_code message e_164_format formatted country line_type line_provider mobile_country_code mobile_network_code ] end |