module BookingSync::API::Client::Conversations
Public Instance Methods
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
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
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 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 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 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