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.
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.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 60 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 @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 |
Instance Attribute Details
#country ⇒ String
The country of the telephone number.
27 28 29 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 27 def country @country end |
#e_164_format ⇒ String
The telephone number in E.164 format.
19 20 21 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 19 def e_164_format @e_164_format end |
#formatted ⇒ String
The formatted version of the telephone number.
23 24 25 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 23 def formatted @formatted end |
#line_provider ⇒ String
The service provider of the telephone number.
35 36 37 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 35 def line_provider @line_provider end |
#line_type ⇒ String
The line type of the telephone number.
31 32 33 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 31 def line_type @line_type end |
#message ⇒ String
Message associated with the response code.
15 16 17 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 15 def @message end |
#mobile_country_code ⇒ String
The first half of the Home Network Identity (HNI).
39 40 41 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 39 def mobile_country_code @mobile_country_code end |
#mobile_network_code ⇒ String
The second half of the HNI.
43 44 45 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 43 def mobile_network_code @mobile_network_code end |
#response_code ⇒ Integer
Our vendor’s response code.
11 12 13 |
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb', line 11 def response_code @response_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# 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'] = 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, , 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.
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# 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 |