Class: DPay::PayoutService
- Inherits:
-
Object
- Object
- DPay::PayoutService
- Defined in:
- lib/dpay/payout/payout_service.rb,
sig/dpay/payout/payout_service.rbs
Instance Method Summary collapse
- #details(withdraw_id, timestamp = nil) ⇒ PayoutDetails
-
#initialize(api) ⇒ PayoutService
constructor
A new instance of PayoutService.
Constructor Details
#initialize(api) ⇒ PayoutService
Returns a new instance of PayoutService.
5 6 7 |
# File 'lib/dpay/payout/payout_service.rb', line 5 def initialize(api) @api = api end |
Instance Method Details
#details(withdraw_id, timestamp = nil) ⇒ PayoutDetails
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dpay/payout/payout_service.rb', line 9 def details(withdraw_id, = nil) body = { "service" => @api.service } body["timestamp"] = unless .nil? body["withdraw_id"] = withdraw_id body["checksum"] = @api.checksum.ordered_body(body.values) data = @api.post_json(Internal::BaseUrls::PANEL, "/api/v1/pbl/withdraws/details", body) unless data.is_a?(Hash) && Internal::Coerce.integer(data["id"]).positive? raise ApiServerError.new("API response carries no payout details", 200, nil, {}, Internal::PHP.json_encode(data)) end PayoutDetails.from_api(data) end |