Class: TalkboxApi::Promotions
- Inherits:
-
Object
- Object
- TalkboxApi::Promotions
- Defined in:
- lib/talkbox_api/promotions.rb
Overview
Promotions resource class This class provides methods for interacting with the Talkbox API promotions resource.
Instance Method Summary collapse
-
#create(params) ⇒ Hash
Creates a new promotion.
-
#delete(id) ⇒ Hash
Deletes a promotion.
-
#initialize(conn) ⇒ Promotions
constructor
A new instance of Promotions.
-
#update(id, params) ⇒ Hash
Updates an existing promotion.
Constructor Details
#initialize(conn) ⇒ Promotions
Returns a new instance of Promotions.
7 8 9 |
# File 'lib/talkbox_api/promotions.rb', line 7 def initialize(conn) @conn = conn end |
Instance Method Details
#create(params) ⇒ Hash
Creates a new promotion
14 15 16 |
# File 'lib/talkbox_api/promotions.rb', line 14 def create(params) @conn.post("#{PATH_PREFIX}/promotions", params.to_json, { "Content-Type" => "application/json" }).body end |
#delete(id) ⇒ Hash
Deletes a promotion
29 30 31 |
# File 'lib/talkbox_api/promotions.rb', line 29 def delete(id) @conn.delete("#{PATH_PREFIX}/promotions/#{id}").body end |
#update(id, params) ⇒ Hash
Updates an existing promotion
22 23 24 |
# File 'lib/talkbox_api/promotions.rb', line 22 def update(id, params) @conn.put("#{PATH_PREFIX}/promotions/#{id}", params.to_json, { "Content-Type" => "application/json" }).body end |