Class: PayU::Customer
Constant Summary
collapse
- ENDPOINT =
"rest/v#{PayU::API_VERSION}/customers".freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Resource
#create_url, #delete, included, #save, #to_update_params
Class Method Details
.new_from_api(params) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pay_u/customer.rb', line 12
def self.new_from_api(params)
customer = super(params)
customer.name = params["fullName"]
if params["creditCards"]
customer.credit_cards = params["creditCards"].map do |credit_card|
PayU::CreditCard.new_from_api(credit_card)
end
end
customer
end
|
Instance Method Details
#to_params ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/pay_u/customer.rb', line 27
def to_params
{
fullName: name,
email: email,
creditCards: credit_cards.map(&:to_params),
}
end
|