Class: Webex::User::Report

Inherits:
Object
  • Object
show all
Includes:
Webex, Webex::User
Defined in:
lib/webex/user/report.rb

Overview

comment

Constant Summary

Constants included from Webex::User

PATH_URL

Constants included from Webex

CONFIGURATION, VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Webex::User

#post_url

Methods included from Webex

#env_attributes!, #option_required!

Constructor Details

#initialize(attributes = {}) ⇒ Report

Returns a new instance of Report.



10
11
12
13
14
# File 'lib/webex/user/report.rb', line 10

def initialize(attributes = {})
  attributes.each { |k, v| send("#{k}=", v) }
  env_attributes!
  option_required! :report_type, :back_url
end

Instance Attribute Details

#back_urlObject

Returns the value of attribute back_url.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def back_url
  @back_url
end

#end_dateObject

Returns the value of attribute end_date.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def end_date
  @end_date
end

#end_monthObject

Returns the value of attribute end_month.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def end_month
  @end_month
end

#end_yearObject

Returns the value of attribute end_year.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def end_year
  @end_year
end

#report_typeObject

Returns the value of attribute report_type.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def report_type
  @report_type
end

#sort_result_byObject

Returns the value of attribute sort_result_by.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def sort_result_by
  @sort_result_by
end

#start_dateObject

Returns the value of attribute start_date.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def start_date
  @start_date
end

#start_monthObject

Returns the value of attribute start_month.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def start_month
  @start_month
end

#start_yearObject

Returns the value of attribute start_year.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def start_year
  @start_year
end

#topicObject

Returns the value of attribute topic.



7
8
9
# File 'lib/webex/user/report.rb', line 7

def topic
  @topic
end

Instance Method Details

#displayObject



16
17
18
19
# File 'lib/webex/user/report.rb', line 16

def display
  res = Net::HTTP.post_form post_url, generate_params(api_type: 'QR')
  Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }]
end

#generate_params(overwrite_params = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/webex/user/report.rb', line 21

def generate_params(overwrite_params = {})
  result = {}
  result[:AT] = overwrite_params[:api_type]
  result[:BU] = back_url
  result[:StartMO] = start_month
  result[:StartYE] = start_year
  result[:StartDA] = start_date
  result[:EndMO] = end_month
  result[:EndYE] = end_year
  result[:EndDA] = end_date
  result[:TC] = topic
  result[:SB] = sort_result_by
  result.delete_if { |k, v| v.nil? }
end