Class: Courier::Audiences
- Inherits:
-
Object
- Object
- Courier::Audiences
- Defined in:
- lib/trycourier/audiences.rb
Constant Summary collapse
- KEY =
"/audiences"
Instance Method Summary collapse
- #get_audience(audience_id:) ⇒ Object
- #get_audience_members(audience_id:, cursor: nil) ⇒ Object
- #get_audiences(cursor: nil) ⇒ Object
-
#initialize(session) ⇒ Audiences
constructor
A new instance of Audiences.
- #put(audience_id:, payload:) ⇒ Object
Constructor Details
#initialize(session) ⇒ Audiences
Returns a new instance of Audiences.
5 6 7 |
# File 'lib/trycourier/audiences.rb', line 5 def initialize(session) @session = session end |
Instance Method Details
#get_audience(audience_id:) ⇒ Object
9 10 11 12 13 |
# File 'lib/trycourier/audiences.rb', line 9 def get_audience(audience_id:) path = "#{KEY}/#{audience_id}" res = @session.send(path, "GET") ErrorHandler.check_err(res) end |
#get_audience_members(audience_id:, cursor: nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/trycourier/audiences.rb', line 25 def get_audience_members(audience_id:, cursor: nil) path = "#{KEY}/#{audience_id}/members" params = {} if cursor params["cursor"] = cursor end res = @session.send(path, "GET", params: params) ErrorHandler.check_err(res) end |
#get_audiences(cursor: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/trycourier/audiences.rb', line 15 def get_audiences(cursor: nil) params = {} if cursor params["cursor"] = cursor end res = @session.send(KEY, "GET", params: params) ErrorHandler.check_err(res) end |
#put(audience_id:, payload:) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/trycourier/audiences.rb', line 37 def put(audience_id:, payload:) path = "#{KEY}/#{audience_id}" res = @session.send(path, "PUT", body: payload) ErrorHandler.check_err(res) end |