Class: Zavudev::Resources::Invitations

Inherits:
Object
  • Object
show all
Defined in:
lib/zavudev/resources/invitations.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Invitations

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Invitations.

Parameters:



113
114
115
# File 'lib/zavudev/resources/invitations.rb', line 113

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(invitation_id, request_options: {}) ⇒ Zavudev::Models::InvitationCancelResponse

Cancel an active invitation. The client will no longer be able to use the invitation link.

Parameters:

Returns:

See Also:



101
102
103
104
105
106
107
108
# File 'lib/zavudev/resources/invitations.rb', line 101

def cancel(invitation_id, params = {})
  @client.request(
    method: :post,
    path: ["v1/invitations/%1$s/cancel", invitation_id],
    model: Zavudev::Models::InvitationCancelResponse,
    options: params[:request_options]
  )
end

#create(allowed_phone_countries: nil, client_email: nil, client_name: nil, client_phone: nil, expires_in_days: nil, phone_number_id: nil, request_options: {}) ⇒ Zavudev::Models::InvitationCreateResponse

Some parameter documentations has been truncated, see Models::InvitationCreateParams for more details.

Create a partner invitation link for a client to connect their WhatsApp Business account. The client will complete Meta’s embedded signup flow and the resulting sender will be created in your project.

Parameters:

  • allowed_phone_countries (Array<String>)

    ISO country codes for allowed phone numbers.

  • client_email (String)

    Email of the client being invited.

  • client_name (String)

    Name of the client being invited.

  • client_phone (String)

    Phone number of the client in E.164 format.

  • expires_in_days (Integer)

    Number of days until the invitation expires.

  • phone_number_id (String)

    ID of a Zavu phone number to pre-assign for WhatsApp registration. If provided,

  • request_options (Zavudev::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
# File 'lib/zavudev/resources/invitations.rb', line 32

def create(params = {})
  parsed, options = Zavudev::InvitationCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/invitations",
    body: parsed,
    model: Zavudev::Models::InvitationCreateResponse,
    options: options
  )
end

#list(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Invitation>

List partner invitations for this project.

Parameters:

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zavudev/resources/invitations.rb', line 77

def list(params = {})
  parsed, options = Zavudev::InvitationListParams.dump_request(params)
  query = Zavudev::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/invitations",
    query: query,
    page: Zavudev::Internal::Cursor,
    model: Zavudev::Invitation,
    options: options
  )
end

#retrieve(invitation_id, request_options: {}) ⇒ Zavudev::Models::InvitationRetrieveResponse

Get invitation

Parameters:

Returns:

See Also:



53
54
55
56
57
58
59
60
# File 'lib/zavudev/resources/invitations.rb', line 53

def retrieve(invitation_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/invitations/%1$s", invitation_id],
    model: Zavudev::Models::InvitationRetrieveResponse,
    options: params[:request_options]
  )
end