Class: Voucherify::Service::Promotions

Inherits:
Object
  • Object
show all
Defined in:
lib/voucherify/service/promotions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Promotions

Returns a new instance of Promotions.



8
9
10
# File 'lib/voucherify/service/promotions.rb', line 8

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/voucherify/service/promotions.rb', line 6

def client
  @client
end

Instance Method Details

#create(campaign) ⇒ Object



12
13
14
# File 'lib/voucherify/service/promotions.rb', line 12

def create(campaign)
  @client.campaigns.create(campaign)
end

#tiersObject



20
21
22
# File 'lib/voucherify/service/promotions.rb', line 20

def tiers
  Voucherify::Service::PromotionTiers.new(@client)
end

#validate(validation_context) ⇒ Object



16
17
18
# File 'lib/voucherify/service/promotions.rb', line 16

def validate(validation_context)
  @client.post('/promotions/validation', validation_context.to_json)
end