Sha256: c428aaea0ada78f321010d6b58a5f48c8f3e4b4803bfbe601d3151846ce99f1b
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
require 'uri' module Voucherify module Service class Promotions attr_reader :client def initialize(client) @client = client end def create(campaign) @client.campaigns.create(campaign) end def validate(validation_context) @client.post('/promotions/validation', validation_context.to_json) end def tiers Voucherify::Service::PromotionTiers.new(@client) end end class PromotionTiers attr_reader :client def initialize(client) @client = client end def list(promotion_id) @client.get("/promotions/#{URI.encode(promotion_id)}/tiers") end def create(promotion_id, promotion_tier) @client.post("/promotions/#{URI.encode(promotion_id)}/tiers", promotion_tier.to_json) end def redeem(promotions_tier_id, redemption_context) @client.post("/promotions/tiers/#{URI.encode(promotions_tier_id)}/redemption", redemption_context.to_json) end def update(promotions_tier) @client.put("/promotions/tiers/#{URI.encode(promotions_tier['id'] || promotions_tier[:id])}", promotions_tier.to_json) end def delete(promotions_tier_id) @client.delete("/promotions/tiers/#{URI.encode(promotions_tier_id)}") nil end end end end
Version data entries
5 entries across 5 versions & 1 rubygems