module BookingSync::API::Client::Conversations

Public Instance Methods

connect_booking_to_conversation(conversation, options) click to toggle source

Connect conversation with booking @param conversation [BookingSync::API::Resource|Integer] Conversation or ID of

the conversation to be connected to booking

@param options [Hash] Id of booking to be connected to conversation. @return [BookingSync::API::Resource] Conversation with updated links on success,

exception is raised otherwise.

@example

@api.connect_booking_to_conversation(conversation, { id: 5 })
# File lib/bookingsync/api/client/conversations.rb, line 58
def connect_booking_to_conversation(conversation, options)
  put("inbox/conversations/#{conversation}/connect_booking", bookings: [options]).pop
end
conversation(conversation) click to toggle source

Get a single conversation

@param conversation [BookingSync::API::Resource|Integer] Conversation or ID

of the conversation.

@return [BookingSync::API::Resource]

# File lib/bookingsync/api/client/conversations.rb, line 24
def conversation(conversation)
  get("inbox/conversations/#{conversation}").pop
end
conversations(options = {}, &block) click to toggle source

List conversations

Returns all conversations supported in BookingSync. @param options [Hash] A customizable set of options. @option options [Array] fields: List of fields to be fetched. @return [Array<BookingSync::API::Resource>] Array of conversations.

@example Get the list of conversations for the current account

conversations = @api.conversations
conversations.first.subject # => "Question"

@see developers.bookingsync.com/reference/endpoints/conversations/#list-conversations

# File lib/bookingsync/api/client/conversations.rb, line 15
def conversations(options = {}, &block)
  paginate "inbox/conversations", options, &block
end
create_conversation(options = {}) click to toggle source

Create a new conversation

@param options [Hash] Conversation’s attributes. @return [BookingSync::API::Resource] Newly created conversation.

# File lib/bookingsync/api/client/conversations.rb, line 32
def create_conversation(options = {})
  post("inbox/conversations", conversations: [options]).pop
end
disconnect_booking_from_conversation(conversation, options) click to toggle source

Disconnect conversation from booking @param conversation [BookingSync::API::Resource|Integer] Conversation or ID of

the conversation connected to booking

@param options [Hash] Id of booking to be disconnected from conversation. @return [BookingSync::API::Resource] Conversation with updated links on success,

exception is raised otherwise.

@example

@api.disconnect_booking_from_conversation(conversation, { id: 5 })
# File lib/bookingsync/api/client/conversations.rb, line 70
def disconnect_booking_from_conversation(conversation, options)
  put("inbox/conversations/#{conversation}/disconnect_booking", bookings: [options]).pop
end
edit_conversation(conversation, options = {}) click to toggle source

Edit a conversation

@param conversation [BookingSync::API::Resource|Integer] Conversation or ID of

the conversation to be updated.

@param options [Hash] Conversation attributes to be updated. @return [BookingSync::API::Resource] Updated conversation on success,

exception is raised otherwise.

@example

conversation = @api.conversations.first
@api.edit_conversation(conversation, { closed: true })
# File lib/bookingsync/api/client/conversations.rb, line 46
def edit_conversation(conversation, options = {})
  put("inbox/conversations/#{conversation}", conversations: [options]).pop
end