Class: SlidePay::ACH::Settlement
- Inherits:
-
Resource
- Object
- Hash
- SlidePay::ApiResource
- Resource
- SlidePay::ACH::Settlement
- Defined in:
- lib/slidepay/ach/settlement.rb
Instance Attribute Summary
Attributes inherited from SlidePay::ApiResource
#api_key, #endpoint, #id_attribute, #token, #url_root
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(values_hash = {}) ⇒ Settlement
constructor
A new instance of Settlement.
Methods inherited from Resource
Methods inherited from SlidePay::ApiResource
api_resource_array_from_response, #destroy, find, find_between, find_greater_than, find_less_than, find_where, #id, #is_new?, #populate_from_response, #retrieve, retrieve, #save, #url
Constructor Details
#initialize(values_hash = {}) ⇒ Settlement
Returns a new instance of Settlement.
7 8 9 10 11 12 |
# File 'lib/slidepay/ach/settlement.rb', line 7 def initialize(values_hash={}) @url_root = "settlement" @id_attribute = "settlement_id" super(values_hash) end |
Class Method Details
.process(settlement_order, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/slidepay/ach/settlement.rb', line 16 def process(settlement_order, ={}) validate_settlement_order(settlement_order) token = @token || [:token] api_key = @api_key || [:api_key] endpoint = @endpoint || [:endpoint] response = SlidePay.post(path: "settlement/manual", api_key: api_key, token: token, endpoint: endpoint, data: settlement_order.to_json) if response.was_successful? return response.data elsif response.error_text raise Exception.new(response.error_text) elsif response.data["status_message"] raise Exception.new(response.data["status_message"]) else raise Exception.new("Settlement(s) could not be processed.") end end |