Sha256: 1daceabd03b2277f8d45ad9da278d55781387b32a604f02cb9162dd8ef30ff4b
Contents?: true
Size: 940 Bytes
Versions: 2
Compression:
Stored size: 940 Bytes
Contents
require 'uri' module Voucherify module Service class Redemptions attr_reader :client def initialize(client) @client = client end def redeem(code, params = {}) @client.post("/vouchers/#{URI.encode(code)}/redemption", params.to_json) end def list(query = {}) @client.get('/redemptions', query) end def get_for_voucher(code) @client.get("/vouchers/#{URI.encode(code)}/redemption") end def rollback(redemption_id, payload = {}) reason = payload['reason'] || payload[:reason] params = reason ? {:reason => reason} : {} payload.delete 'reason' payload.delete :reason @client.post("/redemptions/#{URI.encode(redemption_id)}/rollback", payload.to_json, params) end def get_redemption(redemption_id) @client.get("/redemptions/#{URI.encode(redemption_id)}") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
voucherify-1.5.0 | lib/voucherify/service/redemptions.rb |
voucherify-1.4.0 | lib/voucherify/service/redemptions.rb |