Class: TalkboxApi::Vouchers
- Inherits:
-
Object
- Object
- TalkboxApi::Vouchers
- Defined in:
- lib/talkbox_api/vouchers.rb
Overview
Vouchers resource class This class provides methods for interacting with the Talkbox API vouchers resource.
Instance Method Summary collapse
-
#all(params = nil) ⇒ Array
Retrieves all vouchers.
-
#get(id) ⇒ Hash
Retrieves a specific voucher.
-
#initialize(conn) ⇒ Vouchers
constructor
A new instance of Vouchers.
-
#redeem(id) ⇒ Hash
Redeems a voucher.
Constructor Details
#initialize(conn) ⇒ Vouchers
Returns a new instance of Vouchers.
7 8 9 |
# File 'lib/talkbox_api/vouchers.rb', line 7 def initialize(conn) @conn = conn end |
Instance Method Details
#all(params = nil) ⇒ Array
Retrieves all vouchers
14 15 16 |
# File 'lib/talkbox_api/vouchers.rb', line 14 def all(params = nil) @conn.get("#{PATH_PREFIX}/vouchers", params).body end |
#get(id) ⇒ Hash
Retrieves a specific voucher
21 22 23 |
# File 'lib/talkbox_api/vouchers.rb', line 21 def get(id) @conn.get("#{PATH_PREFIX}/vouchers/#{id}").body end |
#redeem(id) ⇒ Hash
Redeems a voucher
28 29 30 |
# File 'lib/talkbox_api/vouchers.rb', line 28 def redeem(id) @conn.put("#{PATH_PREFIX}/vouchers/#{id}").body end |