class Datmachine::Customer

A customer represents a business or person within your Marketplace. A customer can have many funding instruments such as cards and bank accounts associated to them.

Public Class Methods

find_by_id(id) click to toggle source
# File lib/datmachine/resources/customer.rb, line 31
def self.find_by_id(id)
   Datmachine::Customer.fetch("/customers/#{id}")
end

Public Instance Methods

all_subscriptions() click to toggle source
# File lib/datmachine/resources/customer.rb, line 23
def all_subscriptions 
  subscriptions.to_a
end
create_subscription(options = {}) click to toggle source
# File lib/datmachine/resources/customer.rb, line 10
def create_subscription(options = {})
  options[:href] =  self.subscriptions.href
  subscription = Datmachine::Subscription.new(options)
  subscription.save
end
last_subscription() click to toggle source
# File lib/datmachine/resources/customer.rb, line 27
def last_subscription
  all_subscriptions.last
end
update(options = {}) click to toggle source
# File lib/datmachine/resources/customer.rb, line 16
def update(options = {})
  options.each do |key, value|
    attributes[key] = value
  end
  save 
end