Module: Agilix::Buzz::Commands::General

Included in:
Api
Defined in:
lib/agilix/buzz/commands/general.rb

Instance Method Summary collapse

Instance Method Details

#echo(options = {}) ⇒ Object

api.echo test: ‘param’



7
8
9
# File 'lib/agilix/buzz/commands/general.rb', line 7

def echo(options= {})
  post cmd: "echo", **options
end

#get_basic_status(options = {}) ⇒ Object

this is a non-authenticated call api.get_status



32
33
34
35
# File 'lib/agilix/buzz/commands/general.rb', line 32

def get_basic_status(options = {})
  options = argument_cleaner(required_params: %i(  ), optional_params: %i( rating sms html ), options: options )
  get cmd: "getstatus", **options
end

#get_command_listObject

api.get_command_list



12
13
14
# File 'lib/agilix/buzz/commands/general.rb', line 12

def get_command_list
  get cmd: "getcommandlist"
end

#get_entity_type(options = {}) ⇒ Object

ISSUE: nothing saying this is an authenticated call, when others are non-authenticated api.get_entity_type entityid: 57025



18
19
20
21
# File 'lib/agilix/buzz/commands/general.rb', line 18

def get_entity_type(options = {})
  options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( select ), options: options )
  authenticated_get cmd: "getentitytype", **options
end

#get_status(options = {}) ⇒ Object

ISSUE: docs in getting started reference a ‘level` param, actual docs suggest using rating api.get_status rating: 4, html: true, sms: true



25
26
27
28
# File 'lib/agilix/buzz/commands/general.rb', line 25

def get_status(options = {})
  options = argument_cleaner(required_params: %i(  ), optional_params: %i( rating sms html ), options: options )
  authenticated_get cmd: "getstatus", **options
end

#get_upload_limits(options = {}) ⇒ Object

ISSUE: Docs have cmd spelled wrong, this API doesn’t seem to work at all AccessDenied. It did say experimental api.get_upload_limits api.get_upload_limits domainid: 57025



40
41
42
43
# File 'lib/agilix/buzz/commands/general.rb', line 40

def get_upload_limits(options = {})
  options = argument_cleaner(required_params: %i(  ), optional_params: %i( userid domainid ), options: options )
  get cmd: "getuploadlimits", **options
end

#send_mail(options = {}) ⇒ Object

api.send_mail subject: “Test email”, body: “Did you get this?”, enrollmentid: 60997, enrollment_ids: [“all”]



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/agilix/buzz/commands/general.rb', line 46

def send_mail(options = {})
  options = argument_cleaner(required_params: %i( subject body enrollmentid enrollment_ids ), optional_params: %i( groups roles strings), options: options )
  request = {email: {
    subject: {"$value" => options[:subject]},
    body: {"$value" => options[:body]},
    enrollments: {enrollment: options[:enrollment_ids].map {|id| {id: id} } }
  }}
  request[:email][:groups] = {group: options[:groups].map {|id| {id: id} } } if options[:groups]
  request[:email][:roles] = {role: options[:roles].map {|id| {id: id} } } if options[:roles]
  if options[:strings]
    request[:email][:strings] = options[:strings].map do |k,v|
      [ k , {"$value" => v } ]
    end.to_h
  end
  enrollment_response = self.get_enrollment enrollmentid: options[:enrollmentid]
  user_id = enrollment_response.dig("response", "enrollment", "userid")
  proxy_api = self.proxy_api userid: user_id
  proxy_api.authenticated_query_post query_params: {cmd: "sendmail", enrollmentid: options[:enrollmentid] },  **request
end