Class: PaypalServerSdk::CardFromRequest

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

Overview

Representation of card details as received in the request.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(expiry: SKIP, last_digits: SKIP) ⇒ CardFromRequest

Returns a new instance of CardFromRequest.



42
43
44
45
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 42

def initialize(expiry: SKIP, last_digits: SKIP)
  @expiry = expiry unless expiry == SKIP
  @last_digits = last_digits unless last_digits == SKIP
end

Instance Attribute Details

#expiryString

The year and month, in ISO-8601 ‘YYYY-MM` date format. See [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6).

Returns:

  • (String)


15
16
17
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 15

def expiry
  @expiry
end

#last_digitsString

The last digits of the payment card.

Returns:

  • (String)


19
20
21
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 19

def last_digits
  @last_digits
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 48

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
  last_digits = hash.key?('last_digits') ? hash['last_digits'] : SKIP

  # Create object from extracted values.
  CardFromRequest.new(expiry: expiry,
                      last_digits: last_digits)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['expiry'] = 'expiry'
  @_hash['last_digits'] = 'last_digits'
  @_hash
end

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
35
# File 'lib/paypal_server_sdk/models/card_from_request.rb', line 30

def self.optionals
  %w[
    expiry
    last_digits
  ]
end