class Afterpay::Consumer

Attributes

email[RW]
first_name[RW]
last_name[RW]
phone[RW]

Public Class Methods

from_response(response) click to toggle source

Builds Consumer from response

# File lib/afterpay/consumer.rb, line 24
def self.from_response(response)
  return nil if response.nil?

  new(
    email: response[:email],
    first_name: response[:givenNames],
    last_name: response[:surname],
    phone: response[:phoneNumber]
  )
end
new(email:, phone:, first_name:, last_name:) click to toggle source
# File lib/afterpay/consumer.rb, line 7
def initialize(email:, phone:, first_name:, last_name:)
  @email = email
  @phone = phone
  @first_name = first_name
  @last_name = last_name
end

Public Instance Methods

to_hash() click to toggle source
# File lib/afterpay/consumer.rb, line 14
def to_hash
  {
    phoneNumber: phone,
    givenNames: first_name,
    surname: last_name,
    email: email
  }
end