Class: PaypalServerSdk::Phone
- Defined in:
- lib/paypal_server_sdk/models/phone.rb
Overview
The phone number, in its canonical international E.164 numbering plan format.
Instance Attribute Summary collapse
-
#country_code ⇒ String
The country calling code (CC), in its canonical international E.164 numbering plan format.
-
#extension_number ⇒ String
The extension number.
-
#national_number ⇒ String
The national number, in its canonical international E.164 numbering plan format.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(country_code:, national_number:, extension_number: SKIP) ⇒ Phone
constructor
A new instance of Phone.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(country_code:, national_number:, extension_number: SKIP) ⇒ Phone
Returns a new instance of Phone.
54 55 56 57 58 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 54 def initialize(country_code:, national_number:, extension_number: SKIP) @country_code = country_code @national_number = national_number @extension_number = extension_number unless extension_number == SKIP end |
Instance Attribute Details
#country_code ⇒ String
The country calling code (CC), in its canonical international E.164 numbering plan format. The combined length of the CC and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN).
19 20 21 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 19 def country_code @country_code end |
#extension_number ⇒ String
The extension number.
31 32 33 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 31 def extension_number @extension_number end |
#national_number ⇒ String
The national number, in its canonical international E.164 numbering plan format. The combined length of the country calling code (CC) and the national number must not be greater than 15 digits. The national number consists of a national destination code (NDC) and subscriber number (SN).
27 28 29 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 27 def national_number @national_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 61 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_code = hash.key?('country_code') ? hash['country_code'] : nil national_number = hash.key?('national_number') ? hash['national_number'] : nil extension_number = hash.key?('extension_number') ? hash['extension_number'] : SKIP # Create object from extracted values. Phone.new(country_code: country_code, national_number: national_number, extension_number: extension_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['country_code'] = 'country_code' @_hash['national_number'] = 'national_number' @_hash['extension_number'] = 'extension_number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 43 def self.optionals %w[ extension_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
85 86 87 88 89 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 85 def inspect class_name = self.class.name.split('::').last "<#{class_name} country_code: #{@country_code.inspect}, national_number:"\ " #{@national_number.inspect}, extension_number: #{@extension_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
78 79 80 81 82 |
# File 'lib/paypal_server_sdk/models/phone.rb', line 78 def to_s class_name = self.class.name.split('::').last "<#{class_name} country_code: #{@country_code}, national_number: #{@national_number},"\ " extension_number: #{@extension_number}>" end |