Class: Citrix::Training::Namespace::Registrants

Inherits:
Object
  • Object
show all
Includes:
Helpers::HttpClient, Helpers::Initializer
Defined in:
lib/citrix/training/namespace/registrants.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::HttpClient

#http_client, #json_parser, #url_for

Methods included from Helpers::Initializer

#initialize

Instance Attribute Details

#credentialsObject

Set the credentials.



9
10
11
# File 'lib/citrix/training/namespace/registrants.rb', line 9

def credentials
  @credentials
end

#trainingObject

Set the training.



12
13
14
# File 'lib/citrix/training/namespace/registrants.rb', line 12

def training
  @training
end

Instance Method Details

#allObject

Retrieve details on all registrants for a specific training.

Registrants can be:

  • UNREGISTERED: registrant withdrew their registration but didn’t opt-out of receiving more training or webinar information

  • DELETED: registrant withdrew their registration and opted-out of receiving more information about the training or webinar

  • WAITING: registrant registered and is awaiting approval (where organizer has required approval)

  • APPROVED: registrant registered and is approved

  • DENIED - registrant registered and was not approved.

IMPORTANT: The registrant data caches are typically updated immediately and the data will be returned in the response. However, the update can take as long as two hours.

Endpoint: developer.citrixonline.com/api/gototraining-rest-api/apimethod/get-training-registrants-0



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/citrix/training/namespace/registrants.rb', line 77

def all
  url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants")
  response = http_client.get(url)

  if response.ok?
    registrants = response.data.map do |attrs|
      Resource::Registrant.new Resource::Registrant.deserialize(attrs)
    end
  end

  [response, registrants]
end

#create(attributes) ⇒ Object

Register one person, identified by a unique email address, for a training.

Approval is automatic unless payment or approval is required. The response contains the Confirmation page URL and Join URL for the registrant.

NOTE: If some registrants do not receive a confirmation email, the emails could be getting blocked by their email server due to spam filtering or a grey-listing setting.

response, registrant = client.registrants(training).create({
  first_name: "John",
  last_name: "Doe",
  email: "[email protected]"
})

if response.ok?
  # Do something with registrant
end

Options:

  • ‘first_name`: First name of user. Required.

  • ‘last_name`: Last name of user. Required.

  • ‘email`: Email of registrant. Required.

Endpoint: developer.citrixonline.com/api/gototraining-rest-api/apimethod/register-training-0



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/citrix/training/namespace/registrants.rb', line 42

def create(attributes)
  registrant = Resource::Registrant.new(attributes)

  url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants")
  response = http_client.post(url, registrant.serialize)

  if response.ok?
    additional_attributes = Serializer::Registrant.new(attributes: response.data).deserialize
    additional_attributes.each do |key, value|
      registrant.public_send("#{key}=", value) if value
    end
  end

  [response, registrant]
end

#remove(registrant) ⇒ Object

This call cancels a registration in a scheduled training for a specific registrant.

If the registrant has paid for the training, a cancellation cannot be completed with this method; it must be completed on the Citrix external admin site. No notification is sent to the registrant or the organizer by default. The registrant can re-register if needed.

Endpoint: developer.citrixonline.com/api/gototraining-rest-api/apimethod/cancel-registration-0



100
101
102
103
# File 'lib/citrix/training/namespace/registrants.rb', line 100

def remove(registrant)
  url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants", registrant.key)
  http_client.delete(url)
end