Class: Citrix::Training::Client

Inherits:
Object
  • Object
show all
Includes:
Helpers::Initializer
Defined in:
lib/citrix/training/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Initializer

#initialize

Instance Attribute Details

#credentialsObject

Set credentials.



7
8
9
# File 'lib/citrix/training/client.rb', line 7

def credentials
  @credentials
end

Class Method Details

.build(credentials) ⇒ Object

Initialize a client with provided credentials. The credentials must be a instance of or a Hash accepted by ‘Citrix::Training::Credentials`.

client = Citrix::Training::Client.build(
  oauth_token: ENV.fetch('CITRIX_OAUTH_TOKEN'),
  organizer_key: ENV.fetch('CITRIX_ORGANIZER_KEY'),
  account_key: ENV.fetch('CITRIX_ACCOUNT_KEY')
)


19
20
21
# File 'lib/citrix/training/client.rb', line 19

def self.build(credentials)
  new(credentials: Credentials.build(credentials))
end

Instance Method Details

#registrants(training) ⇒ Object

Return the registrants namespace, which include methods for creating registrants. It requires an existing training. For additional info, check ‘Citrix::Training::Namespace::Registrants`.



33
34
35
# File 'lib/citrix/training/client.rb', line 33

def registrants(training)
  Namespace::Registrants.new(credentials: credentials, training: training)
end

#trainingsObject

Return the training namespace, which include methods for creating and finding trainings. For additional info, check ‘Citrix::Training::Namespace::Trainings`.



26
27
28
# File 'lib/citrix/training/client.rb', line 26

def trainings
  Namespace::Trainings.new(credentials: credentials)
end