Module: VC::AcctOwn

Extended by:
AcctOwn
Included in:
AcctOwn
Defined in:
lib/models/acct_own.rb

Instance Method Summary collapse

Instance Method Details

#acct_own_url(payment_method_id, entity_id) ⇒ Object



27
28
29
# File 'lib/models/acct_own.rb', line 27

def acct_own_url(payment_method_id, entity_id)
  [VC.url, "/payment_methods/#{payment_method_id}/account_ownerships/#{entity_id}"].join
end

#act(args) ⇒ Object



5
6
7
8
# File 'lib/models/acct_own.rb', line 5

def act(args)
  pmid, eid = args.delete(:payment_method_id), args.delete(:entity_id)
  VC.handle_req {RestClient.post(acct_own_url(pmid, eid), args, VC.headers)}
end

#deact(args) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/models/acct_own.rb', line 15

def deact(args)
  pmid = args.delete(:payment_method_id)
  eid = args.delete(:entity_id)
   = args[:account_id]
  time = args[:time]
  VC.handle_req {RestClient.delete([acct_own_url(pmid, eid), CGI.encode("?account_id=#{}&time=#{time}")].join)}
end

#query(args) ⇒ Object



23
24
25
# File 'lib/models/acct_own.rb', line 23

def query(args)
  VC.handle_req {RestClient.get([VC.url, "/accounts/#{args[:account_id]}/resource_ownerships"].join)}
end

#xfr(args) ⇒ Object



10
11
12
13
# File 'lib/models/acct_own.rb', line 10

def xfr(args)
  prev_pmid, prev_eid = args.delete(:prev_payment_method_id), args.delete(:prev_entity_id)
  VC.handle_req {RestClient.put(acct_own_url(prev_pmid, prev_eid), args, VC.headers)}
end