Class: Toktokkie::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/toktokkie/client.rb

Constant Summary collapse

REQUEST_DEFAULTS =
{
  timeout: 10 # seconds
}

Instance Method Summary collapse

Constructor Details

#initialize(key:, secret:, url:) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
# File 'lib/toktokkie/client.rb', line 7

def initialize(key:, secret:, url:)
  @key = key
  @secret = secret
  @url = url
end

Instance Method Details

#create_event(payload: {}, tags: [], recipients_payload: []) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/toktokkie/client.rb', line 13

def create_event(payload: {}, tags: [], recipients_payload: [])
  response = connection.post("api/v1/events") do |request|
    request.body = {
      payload:,
      tags:,
      recipients_payload:
    }.to_json
  end
end