Class: Supersaas::Promotions
- Inherits:
-
BaseApi
- Object
- BaseApi
- Supersaas::Promotions
show all
- Defined in:
- lib/supersaas-api-client/api/promotions.rb
Constant Summary
Constants inherited
from BaseApi
BaseApi::DATETIME_REGEX, BaseApi::INTEGER_REGEX, BaseApi::PROMOTION_REGEX
Instance Attribute Summary
Attributes inherited from BaseApi
#client
Instance Method Summary
collapse
Methods inherited from BaseApi
#initialize
Instance Method Details
22
23
24
25
26
|
# File 'lib/supersaas-api-client/api/promotions.rb', line 22
def duplicate_promotion_code(promotion_code, template_code)
path = '/promotions'
query = { id: validate_promotion(promotion_code), template_code: validate_promotion(template_code) }
client.post(path, query)
end
|
#list(limit = nil, offset = nil) ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/supersaas-api-client/api/promotions.rb', line 6
def list(limit = nil, offset = nil)
path = '/promotions'
params = {}
params.merge!(limit: validate_number(limit)) if limit
params.merge!(offset: validate_number(offset)) if offset
res = client.get(path, params)
res.map { |attributes| Supersaas::Promotion.new(attributes) }
end
|
15
16
17
18
19
20
|
# File 'lib/supersaas-api-client/api/promotions.rb', line 15
def promotion(promotion_code)
path = '/promotions'
query = { promotion_code: validate_promotion(promotion_code) }
res = client.get(path, query)
res.map { |attributes| Supersaas::Promotion.new(attributes) }
end
|