Class: Payouts

Inherits:
OpenPayResource show all
Defined in:
lib/openpay/payouts.rb

Instance Attribute Summary

Attributes inherited from OpenPayResource

#api_hook

Instance Method Summary collapse

Methods inherited from OpenPayResource

#delete, #delete_all, #env, #errors?, #get_with_custom_url, #hash2json, #initialize, #json2hash, #post, #put

Constructor Details

This class inherits a constructor from OpenPayResource

Instance Method Details

#all(customer_id = nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/openpay/payouts.rb', line 5

def all(customer_id=nil)
  if customer_id
    customers=@api_hook.create(:customers)
    customers.all_payouts(customer_id)
  else
    super ''
  end
end

#create(payout, customer_id = nil) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/openpay/payouts.rb', line 36

def create(payout, customer_id=nil)
  if customer_id
    customers=@api_hook.create(:customers)
    customers.create_payout(customer_id, payout)
  else
    super payout
  end
end

#each(customer_id = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/openpay/payouts.rb', line 23

def each(customer_id=nil)
  if customer_id
    customers=@api_hook.create(:customers)
    customers.each_payout(customer_id)  do |cust|
      yield cust
    end
  else
    all.each do |cust|
      yield cust
    end
  end
end

#get(payout = '', customer_id = nil) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/openpay/payouts.rb', line 14

def get(payout='', customer_id=nil)
  if customer_id
    customers=@api_hook.create(:customers)
    customers.get_payout(customer_id, payout)
  else
    super payout
  end
end

#list(search_params, customer_id = nil) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/openpay/payouts.rb', line 45

def list(search_params, customer_id=nil)
  if customer_id
    customers=@api_hook.create(:customers)
    customers.list_payouts(customer_id, search_params)
  else
    super search_params
  end
end