Class: SlidePay::ACH::Retrieval
Instance Attribute Summary collapse
#api_key, #endpoint, #id_attribute, #token, #url_root
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
#destroy, #save
api_resource_array_from_response, #destroy, find, find_between, find_greater_than, find_less_than, find_where, #id, #populate_from_response, retrieve, #retrieve, #save
Constructor Details
#initialize(values_hash = {}) ⇒ Retrieval
Returns a new instance of Retrieval.
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/slidepay/ach/retrieval.rb', line 9
def initialize(values_hash={})
@url_root = "retrieval"
@id_attribute = "retrieval_id"
super(values_hash)
end
|
Instance Attribute Details
#retrieval_bank_account ⇒ Object
Returns the value of attribute retrieval_bank_account.
4
5
6
|
# File 'lib/slidepay/ach/retrieval.rb', line 4
def retrieval_bank_account
@retrieval_bank_account
end
|
Class Method Details
.create_with_bank_account(bank_account, options = {}) ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/slidepay/ach/retrieval.rb', line 79
def create_with_bank_account(bank_account, options={})
token = options[:token]
api_key = options[:api_key]
endpoint = options[:endpoint]
response = SlidePay.post(path: "#{@url_root}/manual", data: bank_account.to_json, token: token, api_key: api_key, endpoint: endpoint)
if response.was_successful?
r = self.new()
r.populate_from_response(response)
end
end
|
.retrieve_by_settlement_token(settlement_transaction_token, options = {}) ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/slidepay/ach/retrieval.rb', line 91
def retrieve_by_settlement_token(settlement_transaction_token, options={})
if ! settlement_transaction_token.is_a? String
raise "settlement_transaction_token must be a String"
end
token = options[:token]
api_key = options[:api_key]
endpoint = options[:endpoint]
url_suffix = "?settlement_transaction_token=#{settlement_transaction_token}"
response = SlidePay.get(path: "#{@url_root}#{url_suffix}", token: token, api_key: api_key, endpoint: endpoint)
if response.was_successful?
r = self.new()
r.populate_from_response(response)
end
end
|
Instance Method Details
#create_with_bank_account(bank_account, options = {}) ⇒ Object
44
45
46
47
48
49
50
51
|
# File 'lib/slidepay/ach/retrieval.rb', line 44
def create_with_bank_account(bank_account, options={})
options[:token] = options[:token] || @token
options[:api_key] = options[:api_key] || @api_key
options[:endpoint] = options[:endpoint] || @endpoint
r = self.class.create_with_bank_account(bank_account, options)
merge! r
end
|
#is_ledgered? ⇒ Boolean
62
63
64
|
# File 'lib/slidepay/ach/retrieval.rb', line 62
def is_ledgered?
return self['ledgered'] == 1
end
|
#is_new? ⇒ Boolean
36
37
38
39
40
41
42
|
# File 'lib/slidepay/ach/retrieval.rb', line 36
def is_new?
if id() == nil && self.settlement_transaction_token == nil
true
else
false
end
end
|
#ledger_after ⇒ Object
66
67
68
|
# File 'lib/slidepay/ach/retrieval.rb', line 66
def ledger_after
return self['ledger_after']
end
|
#provider_status ⇒ Object
74
75
76
|
# File 'lib/slidepay/ach/retrieval.rb', line 74
def provider_status
return self['provider_status']
end
|
#retrieval_amount ⇒ Object
70
71
72
|
# File 'lib/slidepay/ach/retrieval.rb', line 70
def retrieval_amount
return self['retrieval_amount']
end
|
#retrieve_by_settlement_token(settlement_transaction_token, options = {}) ⇒ Object
53
54
55
56
57
58
59
60
|
# File 'lib/slidepay/ach/retrieval.rb', line 53
def retrieve_by_settlement_token(settlement_transaction_token, options={})
options[:token] = options[:token] || @token
options[:api_key] = options[:api_key] || @api_key
options[:endpoint] = options[:endpoint] || @endpoint
r = self.class.retrieve_by_settlement_token(settlement_transaction_token, options)
merge! r
end
|
#settlement_transaction_token ⇒ Object
32
33
34
|
# File 'lib/slidepay/ach/retrieval.rb', line 32
def settlement_transaction_token
self['settlement_transaction_token']
end
|
#url ⇒ Object
url should allow retrieving by settlement_transaction_token
22
23
24
25
26
27
28
29
30
|
# File 'lib/slidepay/ach/retrieval.rb', line 22
def url
if is_new?
@url_root
elsif self.settlement_transaction_token != nil
"#{@url_root}?settlement_transaction_token=#{self['settlement_transaction_token']}"
else
"#{@url_root}/#{self.id()}"
end
end
|