Class: PaypalServerSdk::CardCustomer
- Defined in:
- lib/paypal_server_sdk/models/card_customer.rb
Overview
The details about a customer in PayPal’s system of record.
Instance Attribute Summary collapse
-
#email_address ⇒ String
The internationalized email address.
-
#id ⇒ String
The unique ID for a customer generated by PayPal.
-
#merchant_customer_id ⇒ String
Merchants and partners may already have a data-store where their customer information is persisted.
-
#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, merchant_customer_id: SKIP) ⇒ CardCustomer
constructor
A new instance of CardCustomer.
-
#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, merchant_customer_id: SKIP) ⇒ CardCustomer
Returns a new instance of CardCustomer.
58 59 60 61 62 63 64 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 58 def initialize(id: SKIP, email_address: SKIP, phone: SKIP, merchant_customer_id: SKIP) @id = id unless id == SKIP @email_address = email_address unless email_address == SKIP @phone = phone unless phone == SKIP @merchant_customer_id = merchant_customer_id unless merchant_customer_id == 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.
21 22 23 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 21 def email_address @email_address end |
#id ⇒ String
The unique ID for a customer generated by PayPal.
14 15 16 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 14 def id @id end |
#merchant_customer_id ⇒ String
Merchants and partners may already have a data-store where their customer information is persisted. Use merchant_customer_id to associate the PayPal-generated customer.id to your representation of a customer.
31 32 33 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 31 def merchant_customer_id @merchant_customer_id end |
#phone ⇒ PhoneWithType
The phone information.
25 26 27 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 25 def phone @phone end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 67 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'] merchant_customer_id = hash.key?('merchant_customer_id') ? hash['merchant_customer_id'] : SKIP # Create object from extracted values. CardCustomer.new(id: id, email_address: email_address, phone: phone, merchant_customer_id: merchant_customer_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['email_address'] = 'email_address' @_hash['phone'] = 'phone' @_hash['merchant_customer_id'] = 'merchant_customer_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 44 def self.optionals %w[ id email_address phone merchant_customer_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
92 93 94 95 96 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 92 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, email_address: #{@email_address.inspect}, phone:"\ " #{@phone.inspect}, merchant_customer_id: #{@merchant_customer_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
85 86 87 88 89 |
# File 'lib/paypal_server_sdk/models/card_customer.rb', line 85 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, email_address: #{@email_address}, phone: #{@phone},"\ " merchant_customer_id: #{@merchant_customer_id}>" end |