Class: PaypalServerSdk::SubscriptionCardRequest

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

Overview

The payment card to use to fund a payment. Can be a credit or debit card.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(name: SKIP, number: SKIP, expiry: SKIP, security_code: SKIP, type: SKIP, brand: SKIP, billing_address: SKIP, attributes: SKIP) ⇒ SubscriptionCardRequest

Returns a new instance of SubscriptionCardRequest.



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 86

def initialize(name: SKIP, number: SKIP, expiry: SKIP, security_code: SKIP,
               type: SKIP, brand: SKIP, billing_address: SKIP,
               attributes: SKIP)
  @name = name unless name == SKIP
  @number = number unless number == SKIP
  @expiry = expiry unless expiry == SKIP
  @security_code = security_code unless security_code == SKIP
  @type = type unless type == SKIP
  @brand = brand unless brand == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @attributes = attributes unless attributes == SKIP
end

Instance Attribute Details

#attributesSubscriptionsCardAttributes

Additional attributes associated with the use of this card.



51
52
53
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 51

def attributes
  @attributes
end

#billing_addressAddress

The portable international postal address. Maps to [AddressValidationMetadata](github.com/googlei18n/libaddressinput/ wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls: the autocomplete attribute](www.w3.org/TR/html51/sec-forms.html#autofilling-form-co ntrols-the-autocomplete-attribute).

Returns:



47
48
49
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 47

def billing_address
  @billing_address
end

#brandSubscriptionsCardBrand

The card network or brand. Applies to credit, debit, gift, and payment cards.



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

def brand
  @brand
end

#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)


23
24
25
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 23

def expiry
  @expiry
end

#nameString

The card holder’s name as it appears on the card.

Returns:

  • (String)


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

def name
  @name
end

#numberString

The primary account number (PAN) for the payment card.

Returns:

  • (String)


18
19
20
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 18

def number
  @number
end

#security_codeString

The three- or four-digit security code of the card. Also known as the CVV, CVC, CVN, CVE, or CID. This parameter cannot be present in the request when ‘payment_initiator=MERCHANT`.

Returns:

  • (String)


29
30
31
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 29

def security_code
  @security_code
end

#typeCardType

Type of card. i.e Credit, Debit and so on.

Returns:



33
34
35
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 33

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 100

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  name = hash.key?('name') ? hash['name'] : SKIP
  number = hash.key?('number') ? hash['number'] : SKIP
  expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
  security_code = hash.key?('security_code') ? hash['security_code'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  brand = hash.key?('brand') ? hash['brand'] : SKIP
  billing_address = Address.from_hash(hash['billing_address']) if hash['billing_address']
  attributes = SubscriptionsCardAttributes.from_hash(hash['attributes']) if hash['attributes']

  # Create object from extracted values.
  SubscriptionCardRequest.new(name: name,
                              number: number,
                              expiry: expiry,
                              security_code: security_code,
                              type: type,
                              brand: brand,
                              billing_address: billing_address,
                              attributes: attributes)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['name'] = 'name'
  @_hash['number'] = 'number'
  @_hash['expiry'] = 'expiry'
  @_hash['security_code'] = 'security_code'
  @_hash['type'] = 'type'
  @_hash['brand'] = 'brand'
  @_hash['billing_address'] = 'billing_address'
  @_hash['attributes'] = 'attributes'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 82

def self.nullables
  []
end

.optionalsObject

An array for optional fields



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 68

def self.optionals
  %w[
    name
    number
    expiry
    security_code
    type
    brand
    billing_address
    attributes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



133
134
135
136
137
138
139
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 133

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name.inspect}, number: #{@number.inspect}, expiry:"\
  " #{@expiry.inspect}, security_code: #{@security_code.inspect}, type: #{@type.inspect},"\
  " brand: #{@brand.inspect}, billing_address: #{@billing_address.inspect}, attributes:"\
  " #{@attributes.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/paypal_server_sdk/models/subscription_card_request.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} name: #{@name}, number: #{@number}, expiry: #{@expiry}, security_code:"\
  " #{@security_code}, type: #{@type}, brand: #{@brand}, billing_address: #{@billing_address},"\
  " attributes: #{@attributes}>"
end