Class: Paypal::Masspay::Recipient

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal/masspay/recipient.rb

Constant Summary collapse

RECIPIENT_EMAIL_MAX_LENGTH =
127
RECIPIENT_NOTE_MAX_LENGTH =
4000
RECIPIENT_UNIQUE_ID_MAX_LENGTH =
30

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Recipient

Returns a new instance of Recipient.



7
8
9
10
11
12
# File 'lib/paypal/masspay/recipient.rb', line 7

def initialize(args = {})
  @recipient_email = Paypal::Masspay::LengthValidator.validate(args[:recipient_email], RECIPIENT_EMAIL_MAX_LENGTH, :recipient_email)
  @note            = Paypal::Masspay::LengthValidator.validate(args[:note], RECIPIENT_NOTE_MAX_LENGTH, :note)
  @unique_id       = Paypal::Masspay::LengthValidator.validate(args[:unique_id], RECIPIENT_UNIQUE_ID_MAX_LENGTH, :unique_id)
  @amount          = args[:amount]
end

Instance Method Details

#get_params(index) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/paypal/masspay/recipient.rb', line 14

def get_params(index)
  {
    "L_EMAIL#{index}"    => @recipient_email,
    "L_AMT#{index}"      => @amount,
    "L_NOTE#{index}"     => @note,
    "L_UNIQUEID#{index}" => @unique_id
  }
end