class PinPays::Customers

Constants

PATH

Public Class Methods

charges(customer_token, page = nil) click to toggle source

List all charges for a customer Page - the page number to return (optional)

# File lib/pin_pays/customers.rb, line 35
def charges(customer_token, page = nil)
  options = (page.nil? ? nil : { page: page })
  api_paginated_response(api_get("#{PATH}/#{customer_token}/charges", options))
end
create(email, card) click to toggle source

Creates a customer

card - either a card token (string), or a hash of card details
# File lib/pin_pays/customers.rb, line 9
def create(email, card)
  options = { email: email }
  options = options.merge(card.is_a?(String) ? { card_token: card } : { card: card })
  api_response(api_post(PATH, options))
end
list(page = nil) click to toggle source

List all customers Page - the page number to return (optional)

# File lib/pin_pays/customers.rb, line 17
def list(page = nil)
  options = (page.nil? ? nil : { page: page })
  api_paginated_response(api_get(PATH, options))
end
show(customer_token) click to toggle source

Retrieve details of a specific customer

# File lib/pin_pays/customers.rb, line 23
def show(customer_token)
  api_response(api_get("#{PATH}/#{customer_token}"))
end
update(customer_token, options) click to toggle source

Update a customer Options - a hash specifying one or more of: email, card_token, or card (hash)

# File lib/pin_pays/customers.rb, line 29
def update(customer_token, options)
  api_response(api_put("#{PATH}/#{customer_token}", options))
end