Class: Helpful::Api::Conversations

Inherits:
Object
  • Object
show all
Defined in:
lib/helpful/api/conversations.rb

Overview

Conversations in an account

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Conversations

Returns a new instance of Conversations.



8
9
10
# File 'lib/helpful/api/conversations.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#all(account_id, options = {}) ⇒ Object

List all conversations in an account the user has access to

‘/accounts/:account_id/conversations’ GET

account_id - Identifier of the account



17
18
19
20
21
# File 'lib/helpful/api/conversations.rb', line 17

def all(, options = {})
  body = options.fetch(:query, {})

  @client.get("/accounts/#{}/conversations", body, options)
end

#create(account_id, options = {}) ⇒ Object

Create an empty conversation in account the user has access to

‘/accounts/:account_id/conversations’ POST

account_id - Identifier of the account



28
29
30
31
32
# File 'lib/helpful/api/conversations.rb', line 28

def create(, options = {})
  body = options.fetch(:body, {})

  @client.post("/accounts/#{}/conversations", body, options)
end

#get(conversation_id, options = {}) ⇒ Object

Get a conversation the user has access to

‘/conversations/:conversation_id’ GET

conversation_id - Identifier of the conversation



39
40
41
42
43
# File 'lib/helpful/api/conversations.rb', line 39

def get(conversation_id, options = {})
  body = options.fetch(:query, {})

  @client.get("/conversations/#{conversation_id}", body, options)
end