Class: CloudflareClient::Organization::Invite

Inherits:
CloudflareClient::Organization show all
Defined in:
lib/cloudflare_client/organization/invite.rb

Constant Summary

Constants inherited from CloudflareClient

API_BASE, POSSIBLE_API_SETTINGS, VALID_BUNDLE_METHODS, VALID_DIRECTIONS, VALID_MATCHES, VERSION

Instance Attribute Summary

Attributes inherited from CloudflareClient::Organization

#org_id

Instance Method Summary collapse

Methods inherited from CloudflareClient::Organization

#initialize

Methods inherited from CloudflareClient

#initialize

Constructor Details

This class inherits a constructor from CloudflareClient::Organization

Instance Method Details

#create(email:, roles:, auto_accept: nil) ⇒ Object

create an org invite



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cloudflare_client/organization/invite.rb', line 7

def create(email:, roles:, auto_accept: nil)
  basic_type_check(:email, email, String)
  max_length_check(:email, email, 90)
  non_empty_array_check(:roles, roles)

  data = {invited_member_email: email, roles: roles}

  unless auto_accept.nil?
    valid_value_check(:auto_accept, auto_accept, [true, false])
    data[:auto_accept] = auto_accept
  end

  cf_post(path: "/organizations/#{org_id}/invites", data: data)
end

#delete(id:) ⇒ Object

cancel an organization invite



49
50
51
52
# File 'lib/cloudflare_client/organization/invite.rb', line 49

def delete(id:)
  id_check(:id, id)
  cf_delete(path: "/organizations/#{org_id}/invites/#{id}")
end

#listObject

org invites



24
25
26
# File 'lib/cloudflare_client/organization/invite.rb', line 24

def list
  cf_get(path: "/organizations/#{org_id}/invites")
end

#show(id:) ⇒ Object

org invite details



30
31
32
33
34
# File 'lib/cloudflare_client/organization/invite.rb', line 30

def show(id:)
  id_check(:id, id)

  cf_get(path: "/organizations/#{org_id}/invites/#{id}")
end

#update(id:, roles:) ⇒ Object

update an organization invites roles



38
39
40
41
42
43
44
45
# File 'lib/cloudflare_client/organization/invite.rb', line 38

def update(id:, roles:)
  id_check(:id, id)
  non_empty_array_check(:roles, roles)

  data = {roles: roles}

  cf_patch(path: "/organizations/#{org_id}/invites/#{id}", data: data)
end