Class: Billingrails::Resources::Discounts
- Inherits:
-
Object
- Object
- Billingrails::Resources::Discounts
- Defined in:
- lib/billingrails/resources/discounts.rb
Overview
Discounts resource
Instance Method Summary collapse
-
#create(data) ⇒ Hash
Create a discount.
-
#initialize(client) ⇒ Discounts
constructor
A new instance of Discounts.
-
#list(params: nil) ⇒ Hash
List discounts.
-
#retrieve(id, params: nil) ⇒ Hash
Retrieve discount.
-
#update(id, data) ⇒ Hash
Update a discount.
Constructor Details
#initialize(client) ⇒ Discounts
Returns a new instance of Discounts.
10 11 12 |
# File 'lib/billingrails/resources/discounts.rb', line 10 def initialize(client) @client = client end |
Instance Method Details
#create(data) ⇒ Hash
Create a discount
Creates a discount.
31 32 33 34 |
# File 'lib/billingrails/resources/discounts.rb', line 31 def create(data) path = "/discounts" @client.request(:post, path, body: data) end |
#list(params: nil) ⇒ Hash
List discounts
Retrieve a list of discounts.
20 21 22 23 |
# File 'lib/billingrails/resources/discounts.rb', line 20 def list(params: nil) path = "/discounts" @client.request(:get, path, params: params) end |
#retrieve(id, params: nil) ⇒ Hash
Retrieve discount
Retrieves a discount by ID.
43 44 45 46 |
# File 'lib/billingrails/resources/discounts.rb', line 43 def retrieve(id, params: nil) path = "/discounts/#{id}" @client.request(:get, path, params: params) end |
#update(id, data) ⇒ Hash
Update a discount
Updates a discount.
55 56 57 58 |
# File 'lib/billingrails/resources/discounts.rb', line 55 def update(id, data) path = "/discounts/#{id}" @client.request(:put, path, body: data) end |