Class: Svix::Message
- Inherits:
-
Object
- Object
- Svix::Message
- Defined in:
- lib/svix/api/message.rb
Instance Attribute Summary collapse
-
#poller ⇒ Object
Returns the value of attribute poller.
Instance Method Summary collapse
- #create(app_id, message_in, options = {}) ⇒ Object
- #expunge_all_contents(app_id, options = {}) ⇒ Object
- #expunge_content(app_id, msg_id) ⇒ Object
- #get(app_id, msg_id, options = {}) ⇒ Object
-
#initialize(client) ⇒ Message
constructor
A new instance of Message.
- #list(app_id, options = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Message
Returns a new instance of Message.
37 38 39 40 |
# File 'lib/svix/api/message.rb', line 37 def initialize(client) @client = client @poller = MessagePoller.new(client) end |
Instance Attribute Details
#poller ⇒ Object
Returns the value of attribute poller.
36 37 38 |
# File 'lib/svix/api/message.rb', line 36 def poller @poller end |
Instance Method Details
#create(app_id, message_in, options = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/svix/api/message.rb', line 61 def create(app_id, , = {}) = .transform_keys(&:to_s) res = @client.execute_request( "POST", "/api/v1/app/#{app_id}/msg", query_params: { "with_content" => ["with_content"] }, headers: { "idempotency-key" => ["idempotency-key"] }, body: ) MessageOut.deserialize(res) end |
#expunge_all_contents(app_id, options = {}) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/svix/api/message.rb', line 77 def expunge_all_contents(app_id, = {}) = .transform_keys(&:to_s) res = @client.execute_request( "POST", "/api/v1/app/#{app_id}/msg/expunge-all-contents", headers: { "idempotency-key" => ["idempotency-key"] } ) ExpungeAllContentsOut.deserialize(res) end |
#expunge_content(app_id, msg_id) ⇒ Object
101 102 103 104 105 106 |
# File 'lib/svix/api/message.rb', line 101 def expunge_content(app_id, msg_id) @client.execute_request( "DELETE", "/api/v1/app/#{app_id}/msg/#{msg_id}/content" ) end |
#get(app_id, msg_id, options = {}) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/svix/api/message.rb', line 89 def get(app_id, msg_id, = {}) = .transform_keys(&:to_s) res = @client.execute_request( "GET", "/api/v1/app/#{app_id}/msg/#{msg_id}", query_params: { "with_content" => ["with_content"] } ) MessageOut.deserialize(res) end |
#list(app_id, options = {}) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/svix/api/message.rb', line 42 def list(app_id, = {}) = .transform_keys(&:to_s) res = @client.execute_request( "GET", "/api/v1/app/#{app_id}/msg", query_params: { "limit" => ["limit"], "iterator" => ["iterator"], "channel" => ["channel"], "before" => ["before"], "after" => ["after"], "with_content" => ["with_content"], "tag" => ["tag"], "event_types" => ["event_types"] } ) ListResponseMessageOut.deserialize(res) end |