Class: PaypalServerSdk::CustomerInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::CustomerInformation
- Defined in:
- lib/paypal_server_sdk/models/customer_information.rb
Overview
This object represents a merchant’s customer, allowing them to store contact details, and track all payments associated with the same customer.
Instance Attribute Summary collapse
-
#email_address ⇒ String
The internationalized email address.
-
#id ⇒ String
The unique ID for a customer generated by PayPal.
-
#name ⇒ Name
The name of the party.
-
#phone ⇒ PhoneWithType
The phone information.
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(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP) ⇒ CustomerInformation
constructor
A new instance of CustomerInformation.
-
#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(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP) ⇒ CustomerInformation
Returns a new instance of CustomerInformation.
57 58 59 60 61 62 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 57 def initialize(id: SKIP, email_address: SKIP, phone: SKIP, name: SKIP) @id = id unless id == SKIP @email_address = email_address unless email_address == SKIP @phone = phone unless phone == SKIP @name = name unless name == SKIP end |
Instance Attribute Details
#email_address ⇒ String
The internationalized email address. Note: Up to 64 characters are allowed before and 255 characters are allowed after the @ sign. However, the generally accepted maximum length for an email address is 254 characters. The pattern verifies that an unquoted @ sign exists.
22 23 24 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 22 def email_address @email_address end |
#id ⇒ String
The unique ID for a customer generated by PayPal.
15 16 17 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 15 def id @id end |
#name ⇒ Name
The name of the party.
30 31 32 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 30 def name @name end |
#phone ⇒ PhoneWithType
The phone information.
26 27 28 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 26 def phone @phone end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP email_address = hash.key?('email_address') ? hash['email_address'] : SKIP phone = PhoneWithType.from_hash(hash['phone']) if hash['phone'] name = Name.from_hash(hash['name']) if hash['name'] # Create object from extracted values. CustomerInformation.new(id: id, email_address: email_address, phone: phone, name: name) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['email_address'] = 'email_address' @_hash['phone'] = 'phone' @_hash['name'] = 'name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 46 47 48 49 50 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 43 def self.optionals %w[ id email_address phone name ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
89 90 91 92 93 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 89 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}, phone:"\ " #{@phone.inspect}, name: #{@name.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 |
# File 'lib/paypal_server_sdk/models/customer_information.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone}, name:"\ " #{@name}>" end |