Class: EasyLabs::Resources::PromotionCodes
- Inherits:
-
Base
- Object
- Base
- EasyLabs::Resources::PromotionCodes
show all
- Defined in:
- lib/easylabs/resources/promotion_codes.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#create(**body) ⇒ Object
8
9
10
|
# File 'lib/easylabs/resources/promotion_codes.rb', line 8
def create(**body)
request(:post, "/promotion-codes", body: body)
end
|
#delete(id) ⇒ Object
25
26
27
|
# File 'lib/easylabs/resources/promotion_codes.rb', line 25
def delete(id)
request(:delete, "/promotion-codes/#{id}")
end
|
#list(limit: nil, offset: nil, ids: nil) ⇒ Object
12
13
14
15
|
# File 'lib/easylabs/resources/promotion_codes.rb', line 12
def list(limit: nil, offset: nil, ids: nil)
request(:get, "/promotion-codes",
query: (limit: limit, offset: offset, ids: ids))
end
|
#retrieve(id) ⇒ Object
17
18
19
|
# File 'lib/easylabs/resources/promotion_codes.rb', line 17
def retrieve(id)
request(:get, "/promotion-codes/#{id}")
end
|
#update(id, **body) ⇒ Object
21
22
23
|
# File 'lib/easylabs/resources/promotion_codes.rb', line 21
def update(id, **body)
request(:patch, "/promotion-codes/#{id}", body: body)
end
|
#validate(code:, identity_id: nil, amount: nil) ⇒ Object
POST /promotion-codes/validate { code, identity_id?, amount? }
30
31
32
33
|
# File 'lib/easylabs/resources/promotion_codes.rb', line 30
def validate(code:, identity_id: nil, amount: nil)
body = { code: code, identity_id: identity_id, amount: amount }.compact
request(:post, "/promotion-codes/validate", body: body)
end
|