Class: Waves::Client
Instance Method Summary collapse
- #account ⇒ Object
-
#initialize(token: nil, timeout: Waves.timeout) ⇒ Client
constructor
A new instance of Client.
- #list_sessions(limit: nil, cursor: nil, since: nil, type: nil) ⇒ Object
- #search_sessions(query:, limit: nil) ⇒ Object
- #session(id) ⇒ Object
- #stats(since: nil, until_time: nil, until_: nil) ⇒ Object
- #transcript(id) ⇒ Object
Constructor Details
#initialize(token: nil, timeout: Waves.timeout) ⇒ Client
Returns a new instance of Client.
12 13 14 15 16 17 |
# File 'lib/waves/client.rb', line 12 def initialize(token: nil, timeout: Waves.timeout) @token = token || Config.token @timeout = timeout raise InvalidConfigError, "Missing Wave API token" if @token.to_s.empty? end |
Instance Method Details
#account ⇒ Object
50 51 52 |
# File 'lib/waves/client.rb', line 50 def account request(:get, "/account") end |
#list_sessions(limit: nil, cursor: nil, since: nil, type: nil) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/waves/client.rb', line 19 def list_sessions(limit: nil, cursor: nil, since: nil, type: nil) request(:get, "/sessions", query: { limit: limit, cursor: cursor, since: since, type: type }) end |
#search_sessions(query:, limit: nil) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/waves/client.rb', line 32 def search_sessions(query:, limit: nil) request(:post, "/sessions/search", body: { query: query, limit: limit }) end |
#session(id) ⇒ Object
28 29 30 |
# File 'lib/waves/client.rb', line 28 def session(id) request(:get, "/sessions/#{id}") end |
#stats(since: nil, until_time: nil, until_: nil) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/waves/client.rb', line 43 def stats(since: nil, until_time: nil, until_: nil) request(:get, "/sessions/stats", query: { since: since, until: until_time || until_ }) end |
#transcript(id) ⇒ Object
39 40 41 |
# File 'lib/waves/client.rb', line 39 def transcript(id) request(:get, "/sessions/#{id}/transcript") end |