Class: PaypalServerSdk::CobrandedCard

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

Overview

Details about the merchant cobranded card used for order purchase.

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(labels: SKIP, payee: SKIP, amount: SKIP) ⇒ CobrandedCard

Returns a new instance of CobrandedCard.



49
50
51
52
53
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 49

def initialize(labels: SKIP, payee: SKIP, amount: SKIP)
  @labels = labels unless labels == SKIP
  @payee = payee unless payee == SKIP
  @amount = amount unless amount == SKIP
end

Instance Attribute Details

#amountMoney

The currency and amount for a financial transaction, such as a balance or payment due.

Returns:



24
25
26
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 24

def amount
  @amount
end

#labelsArray[String]

Array of labels for the cobranded card.

Returns:

  • (Array[String])


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

def labels
  @labels
end

#payeePayeeBase

The details for the merchant who receives the funds and fulfills the order. The merchant is also known as the payee.

Returns:



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

def payee
  @payee
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  labels = hash.key?('labels') ? hash['labels'] : SKIP
  payee = PayeeBase.from_hash(hash['payee']) if hash['payee']
  amount = Money.from_hash(hash['amount']) if hash['amount']

  # Create object from extracted values.
  CobrandedCard.new(labels: labels,
                    payee: payee,
                    amount: amount)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['labels'] = 'labels'
  @_hash['payee'] = 'payee'
  @_hash['amount'] = 'amount'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    labels
    payee
    amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



77
78
79
80
81
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 77

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} labels: #{@labels.inspect}, payee: #{@payee.inspect}, amount:"\
  " #{@amount.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
# File 'lib/paypal_server_sdk/models/cobranded_card.rb', line 71

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} labels: #{@labels}, payee: #{@payee}, amount: #{@amount}>"
end