Class: Voucherify::Service::Promotions
- Inherits:
-
Object
- Object
- Voucherify::Service::Promotions
- Defined in:
- lib/voucherify/service/promotions.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #create(campaign) ⇒ Object
-
#initialize(client) ⇒ Promotions
constructor
A new instance of Promotions.
- #tiers ⇒ Object
- #validate(validation_context) ⇒ Object
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
#client ⇒ Object (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 |
#tiers ⇒ Object
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 |