class Voucherify::Service::PromotionTiers
Attributes
client[R]
Public Class Methods
new(client)
click to toggle source
# File lib/voucherify/service/promotions.rb, line 28 def initialize(client) @client = client end
Public Instance Methods
create(promotion_id, promotion_tier)
click to toggle source
# File lib/voucherify/service/promotions.rb, line 36 def create(promotion_id, promotion_tier) @client.post("/promotions/#{ERB::Util.url_encode(promotion_id)}/tiers", promotion_tier.to_json) end
delete(promotions_tier_id)
click to toggle source
# File lib/voucherify/service/promotions.rb, line 48 def delete(promotions_tier_id) @client.delete("/promotions/tiers/#{ERB::Util.url_encode(promotions_tier_id)}") nil end
list(promotion_id)
click to toggle source
# File lib/voucherify/service/promotions.rb, line 32 def list(promotion_id) @client.get("/promotions/#{ERB::Util.url_encode(promotion_id)}/tiers") end
list_tiers(query = {})
click to toggle source
# File lib/voucherify/service/promotions.rb, line 53 def list_tiers(query = {}) @client.get("/promotions/tiers", query) end
redeem(promotions_tier_id, redemption_context)
click to toggle source
# File lib/voucherify/service/promotions.rb, line 40 def redeem(promotions_tier_id, redemption_context) @client.post("/promotions/tiers/#{ERB::Util.url_encode(promotions_tier_id)}/redemption", redemption_context.to_json) end
update(promotions_tier)
click to toggle source
# File lib/voucherify/service/promotions.rb, line 44 def update(promotions_tier) @client.put("/promotions/tiers/#{ERB::Util.url_encode(promotions_tier['id'] || promotions_tier[:id])}", promotions_tier.to_json) end