Class: PaypalServerSdk::PaypalWalletCustomer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/paypal_wallet_customer.rb

Overview

The details about a customer in PayPal’s system of record.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id: SKIP, email_address: SKIP, phone: SKIP, merchant_customer_id: SKIP) ⇒ PaypalWalletCustomer

Returns a new instance of PaypalWalletCustomer.



59
60
61
62
63
64
65
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 59

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_addressString

The internationalized email address.<blockquote><strong>Note:</strong> 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.</blockquote>

Returns:

  • (String)


22
23
24
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 22

def email_address
  @email_address
end

#idString

The unique ID for a customer generated by PayPal.

Returns:

  • (String)


14
15
16
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 14

def id
  @id
end

#merchant_customer_idString

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.

Returns:

  • (String)


32
33
34
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 32

def merchant_customer_id
  @merchant_customer_id
end

#phonePhoneWithType

The phone information.

Returns:



26
27
28
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 26

def phone
  @phone
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 68

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.
  PaypalWalletCustomer.new(id: id,
                           email_address: email_address,
                           phone: phone,
                           merchant_customer_id: merchant_customer_id)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 35

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

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
52
# File 'lib/paypal_server_sdk/models/paypal_wallet_customer.rb', line 45

def self.optionals
  %w[
    id
    email_address
    phone
    merchant_customer_id
  ]
end