class Voucherify::Service::Validations
Attributes
client[R]
Public Class Methods
new(client)
click to toggle source
# File lib/voucherify/service/validations.rb, line 8 def initialize(client) @client = client end
Public Instance Methods
validate(code, context = {})
click to toggle source
# File lib/voucherify/service/validations.rb, line 16 def validate(code, context = {}) if code.is_a? Hash context = code return @client.promotions.validate(context) end @client.validations.validate_voucher(code, context) end
validate_voucher(code, context = {})
click to toggle source
# File lib/voucherify/service/validations.rb, line 12 def validate_voucher(code, context = {}) @client.post("/vouchers/#{ERB::Util.url_encode(code)}/validate", context.to_json) end